Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3359918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:55:51+00:00 2026-05-18T02:55:51+00:00

I have created a data access layer in my web app which uses ObjectDataSource

  • 0

I have created a data access layer in my web app which uses ObjectDataSource instead of SqlDataSource. I have a FormView to update some data in my database. In my old asp.net code I had something like:

<asp:SqlDataSource ID="sdsTradeDetails" runat="server" 
 ConnectionString="<%$ ConnectionStrings:ForexDB %>" 
 SelectCommand="usp_GetTrade" SelectCommandType="StoredProcedure" 
 UpdateCommand="usp_UpdateTrade" UpdateCommandType="StoredProcedure" 
 <SelectParameters>
  <asp:ControlParameter Name="tradeId" ControlID="grdTrades" PropertyName="SelectedDataKey.Value" />            
 </SelectParameters>
 <UpdateParameters>
  <asp:ControlParameter Name="tradeId" ControlId="frmTrade" PropertyName="SelectedValue"  />
 </UpdateParameters>
</asp:SqlDataSource>

Which worked fine. I have replaced the SqlDataSource with this:

<asp:ObjectDataSource
 id="srcTrade" 
 TypeName="DatabaseComponent.DBUtil" 
 SelectMethod="GetTrade"
 UpdateMethod="UpdateTrade"
 runat="server">
 <SelectParameters>
  <asp:QueryStringParameter Name="tradeId" QueryStringField="tradeId" />               
 </SelectParameters>
 <UpdateParameters>
  <asp:ControlParameter Name="tradeId" ControlId="frmTrade" PropertyName="SelectedValue"  />
 </UpdateParameters>
</asp:ObjectDataSource>

But now I get this error when I click the Update button in my FormView:

Exception Details:
System.InvalidOperationException:
ObjectDataSource ‘srcTrade’ could not
find a non-generic method
‘UpdateTrade’ that has parameters:
symbol, pctAccountRisked,
tradeSetupId, lotsPerUnit,
initialStopPrice, tfCode, MAEPips,
MFEPips, tradeGrade, executionGrade,
tradeTypeId, comment, tradeId.

In my DBUtil class I have this for UpdateTrade:

public void UpdateTrade(
 int tradeId, 
 string symbol, 
 decimal pctAccountRisked, 
 string tradeSetupId, 
 decimal lotsPerUnit, 
 decimal initialStopPrice, 
 string tfCode, 
 int MAEPips, 
 int MFEPips, 
 int tradeGrade, 
 int executionGrade, 
 string comment)
{
 SqlCommand cmd = new SqlCommand("usp_UpdateTrade");
 cmd.Parameters.AddWithValue("@tradeId", tradeId);
 cmd.Parameters.AddWithValue("@symbol", symbol);
 cmd.Parameters.AddWithValue("@pctAccountRisked", pctAccountRisked);
 cmd.Parameters.AddWithValue("@tradeSetupId", tradeSetupId);
 cmd.Parameters.AddWithValue("@lotsPerUnit", lotsPerUnit);
 cmd.Parameters.AddWithValue("@initialStopPrice", initialStopPrice);
 cmd.Parameters.AddWithValue("@tfCode", tfCode);
 cmd.Parameters.AddWithValue("@MAEPips", MAEPips);
 cmd.Parameters.AddWithValue("@MFEPips", MFEPips);
 cmd.Parameters.AddWithValue("@tradeGrade", tradeGrade);
 cmd.Parameters.AddWithValue("@executionGrade", executionGrade);
 cmd.Parameters.AddWithValue("@comment", comment);
 UpdateTable(cmd, "trade");
}

and this for GetTrade:

public DataTable GetTrade(int tradeId)
{
 SqlCommand cmd = new SqlCommand("usp_GetTrade");
 cmd.Parameters.AddWithValue("@tradeId", tradeId);
 return FillDataTable(cmd, "trade");
}

Please help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:55:52+00:00Added an answer on May 18, 2026 at 2:55 am

    Hi your UpdateTrade method and the passing parameters from your datasource are missmatching. please recheck them

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an application that writes some data to the root folder of
in my data layer class I have created a function to manually refresh the
We have created a control that needs to persist data via the ViewState property
I have created an HttpCookie in order to share data across a subdomain :
I have a table of paged data, along with a dynamically created pager (server-side
I have a VB application which extracts data and creates 3 CSV files (a.csv,
I have some kind of test data and want to create a unit test
I have a table of the form CREATE TABLE data { pk INT PRIMARY
Does anyone have a technique for generating SQL table create (and data insert) commands
I have the following table and data in SQL Server 2005: create table LogEntries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.