Solved

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

Posted on 2011-03-09
1
684 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 500 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

728 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