ObjectDataSource'ObjectDataSource1'找不到具有参数的非泛型方法'UpdateProdus':

时间:2014-05-06 07:05:39

标签: objectdatasource

ASPX代码:

   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1">
                        <Columns>
                            <asp:CommandField ShowEditButton="True" />
                            <asp:BoundField DataField="pId" HeaderText="pId" SortExpression="pId" />
                            <asp:BoundField DataField="pName" HeaderText="pName" SortExpression="pName" />
                            <asp:BoundField DataField="pUnitateMasura" HeaderText="pUnitateMasura" SortExpression="pUnitateMasura" />
                            <asp:BoundField DataField="pPret" HeaderText="pPret" SortExpression="pPret" />
                            <asp:BoundField DataField="pStocInitial" HeaderText="pStocInitial" SortExpression="pStocInitial" />
                            <asp:BoundField DataField="pIntrariMarfa" HeaderText="pIntrariMarfa" SortExpression="pIntrariMarfa" />
                            <asp:BoundField DataField="pStocRamas" HeaderText="pStocRamas" SortExpression="pStocRamas" />
                            <asp:BoundField DataField="pCantitateVanduta" HeaderText="pCantitateVanduta" SortExpression="pCantitateVanduta" />
                            <asp:BoundField DataField="pValoareVanduta" HeaderText="pValoareVanduta" SortExpression="pValoareVanduta" />
                        </Columns>
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteProdus" SelectMethod="GetAllProduse" TypeName="ProduseDataAccesLayer" UpdateMethod="UpdateProdus">
                        <DeleteParameters>
                            <asp:Parameter Name="pId" Type="Int32" />
                        </DeleteParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="LabelUserIdentity"              Name="NumeUser" PropertyName="Text" Type="String" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="pId" Type="Int32" />
                            <asp:Parameter Name="pName" Type="String" />
                            <asp:Parameter Name="pUnitateMasura" Type="Double" />
                            <asp:Parameter Name="pPret" Type="Double" />
                            <asp:Parameter Name="pStocInitial" Type="Double" />
                            <asp:Parameter Name="pIntrariMarfa" Type="Double" />
                            <asp:Parameter Name="pStocRamas" Type="Double" />
                        </UpdateParameters>
                    </asp:ObjectDataSource>

我的方法:

public static void UpdateProdus(int pId,string pName,double pUnitateMasura,double pPret,double pStocInitial,double pIntrariMarfa,double pStocRamas)     {         using(MySqlConnection myCon = new MySqlConnection(ConfigurationManager.ConnectionStrings [&#34; amstoc&#34;]。ConnectionString))         {             MySqlCommand cmd = new MySqlCommand(&#34; sp_UpdateProdus&#34;,myCon);             cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("iProdus", pId);
        cmd.Parameters.AddWithValue("prodNume", pName);
        cmd.Parameters.AddWithValue("prodUnitateMasura", pUnitateMasura);
        cmd.Parameters.AddWithValue("prodPret", pPret);
        cmd.Parameters.AddWithValue("prodStocInitial", pStocInitial);
        cmd.Parameters.AddWithValue("prodIntrariMarfa", pIntrariMarfa);
        cmd.Parameters.AddWithValue("prodStocRamas", pStocRamas);

        myCon.Open();

        cmd.ExecuteNonQuery();
    } 
}

我存储的Procerure:

创建DEFINER = root @ localhost程序sp_UpdateProdus(在iProdus int中,在prodNume nvarchar(120)中,在prodUnitateMasura中,在prodPret double中,在prodStocInitial中,在prodIntrariMarfa中,在prodStocRamas中加倍) BEGIN

update tblproduse set tblproduse.ProdusNume = prodNume, tblproduse.ProdusUnitateMasura = prodUnitateMasura, tblproduse.ProdusPret = prodPret, tblproduse.ProdusStocInitial = prodStocInitial, tblproduse.ProdusIntrariMarfa = prodIntrariMarfa, tblproduse.ProdusStocRamas = prodStocRamas where tblproduse.ProdusId = iProdus;

END

0 个答案:

没有答案