[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method

Posted on 2011-03-09
1
Medium Priority
?
703 Views
Last Modified: 2012-05-11
Hi EE,

I have code below which is generating following error msg. PLS HELP!!

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateSubPublicationDetails' that has parameters: ContactName, ContactPhone, ContactEmail, ContactCity, ContactNotes, HL, PR, Disable, Sectors, PubID, Format, PublicID, fmt, PubContactID.


Thank U!!!
[index.aspx]
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" 
        DataSourceID="ObjectDataSource1" EnableModelValidation="True" 
        AutoGenerateRows="False" DataKeyNames="PubContactID">
        <Fields>
            <asp:BoundField DataField="PubContactID" HeaderText="PubContactID" 
                InsertVisible="False" ReadOnly="True" SortExpression="PubContactID" />
            <asp:BoundField DataField="ContactName" HeaderText="ContactName" 
                SortExpression="ContactName" />
            <asp:BoundField DataField="ContactPhone" HeaderText="ContactPhone" 
                SortExpression="ContactPhone" />
            <asp:BoundField DataField="ContactEmail" HeaderText="ContactEmail" 
                SortExpression="ContactEmail" />
            <asp:BoundField DataField="ContactCity" HeaderText="ContactCity" 
                SortExpression="ContactCity" />
            <asp:BoundField DataField="ContactNotes" HeaderText="ContactNotes" 
                SortExpression="ContactNotes" />
            <asp:BoundField DataField="PublicID" HeaderText="PublicID" 
                SortExpression="PublicID" />            
            <asp:BoundField DataField="Sectors" HeaderText="Sectors" 
                SortExpression="Sectors" />
            <asp:BoundField DataField="fmt" HeaderText="fmt" SortExpression="fmt" />            
            <asp:CommandField ShowEditButton="True" />
        </Fields>
    </asp:DetailsView>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        SelectMethod="GetSubPublicationDetails" TypeName="DataAccess" 
        UpdateMethod="UpdateSubPublicationDetails" 
        onupdated="ObjectDataSource1_Updated">
        <SelectParameters>
            <asp:QueryStringParameter Name="PubID" QueryStringField="id" Type="Int32" 
                DefaultValue="" />
            <asp:QueryStringParameter DefaultValue="eng" Name="lang" 
                QueryStringField="lang" Type="String" />
        </SelectParameters>

        <UpdateParameters>
            <asp:Parameter Name="ContactName" Type="String" />
            <asp:Parameter Name="ContactPhone" Type="String" />
            <asp:Parameter Name="ContactEmail" Type="String" />
            <asp:Parameter Name="ContactCity" Type="String" />
            <asp:Parameter Name="ContactNotes" Type="String" />            
            <asp:Parameter Name="HL" Type="Int32" DefaultValue="0" />
            <asp:Parameter Name="PR" Type="Int32" DefaultValue="1" />
            <asp:Parameter Name="Disable" Type="Int32" DefaultValue="0" />
            <asp:Parameter Name="Sectors" Type="String" />
            <asp:Parameter Name="PubID" Type="Int32" />   
            <asp:Parameter Name="PubContactID" Type="Int32" />                     
            <asp:Parameter Name="Format" Type="String" />   
        </UpdateParameters>
    </asp:ObjectDataSource>

[DataAccess.cs]
public static int UpdateSubPublicationDetails(string ContactName,string ContactPhone,string ContactEmail, string ContactCity, string ContactNotes,int HL, int PR, int Disable, string Sectors, int PubID, int PubContactID, string Format) {
        int rowAffect = 0;
        using (SqlConnection con = new SqlConnection(Settings.ConnectionStringACN))
        {
            con.Open();
            string SQL = "spSvePubContact";
            using (SqlCommand cmd = new SqlCommand(SQL, con))
            {
                cmd.Parameters.Add("@ContactName",SqlDbType.VarChar).Value=ContactName;
                cmd.Parameters.Add("@ContactPhone", SqlDbType.VarChar).Value = ContactPhone;
                cmd.Parameters.Add("@ContactEmail", SqlDbType.VarChar).Value = ContactEmail;
                cmd.Parameters.Add("@ContactCity", SqlDbType.VarChar).Value = ContactCity;
                cmd.Parameters.Add("@ContactNotes", SqlDbType.VarChar).Value = ContactNotes;
                cmd.Parameters.Add("@HL", SqlDbType.Int).Value = 0;
                cmd.Parameters.Add("@PR", SqlDbType.Int).Value = 1;
                cmd.Parameters.Add("@Disable", SqlDbType.Int).Value = 0;
                cmd.Parameters.Add("@Sectors", SqlDbType.VarChar).Value = Sectors;
                cmd.Parameters.Add("@PubID", SqlDbType.Int).Value = PubID;
                cmd.Parameters.Add("@PubContactID", SqlDbType.Int).Value = PubContactID;
                cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = Format;
                cmd.CommandType = CommandType.StoredProcedure;
                rowAffect = cmd.ExecuteNonQuery();				
            }
            con.Close();
        }
        return rowAffect;
    }

Open in new window

0
Comment
Question by:saloj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 2000 total points
ID: 35089523
This is occurring because parameters automatically get created for the bound controls based on the datafield value you must ensure the parameter names match the datafield values used on the bound controls.

More info : http://msdn.microsoft.com/en-us/library/57hkzhy5.aspx
http://msdn.microsoft.com/en-us/library/ms228051.aspx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question