J
Jeff
hi
asp.net 2.0
I have a gridview which I'm trying to update a row within. When I click on
the Update button, my website crash. It displays a webpage saying that a
parameter is missing. So I wonder what's wrong in my code. Below I post
parts of my code
<asp:ObjectDataSource ID="odsPhoneType"
TypeName="SqlPhoneProvider"
SelectMethod="getPhoneTypes" UpdateMethod="updatePhoneType"
InsertMethod="insertPhoneType" runat="server">
<UpdateParameters>
<asparameter Type="Int32" Name="Id" />
<asparameter Type="Char" Name="type" Direction="Input" />
<asparameter Type="string" Name="desc" Direction="Input" />
</UpdateParameters>
<InsertParameters>
<asparameter Type="Char" Name="Type" />
<asparameter Type="string" Name="Desc" />
</InsertParameters>
</asp:ObjectDataSource
public override void updatePhoneType(int id, char type, string desc)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("UpdatePhoneType", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;
cmd.Parameters.Add("@type", SqlDbType.NChar).Value = type;
cmd.Parameters.Add("@desc", SqlDbType.NVarChar).Value = desc;
cn.Open();
cmd.ExecuteNonQuery();
}
}
it complains about @desc, but I guess this problem is for @type also
any suggestions?
asp.net 2.0
I have a gridview which I'm trying to update a row within. When I click on
the Update button, my website crash. It displays a webpage saying that a
parameter is missing. So I wonder what's wrong in my code. Below I post
parts of my code
<asp:ObjectDataSource ID="odsPhoneType"
TypeName="SqlPhoneProvider"
SelectMethod="getPhoneTypes" UpdateMethod="updatePhoneType"
InsertMethod="insertPhoneType" runat="server">
<UpdateParameters>
<asparameter Type="Int32" Name="Id" />
<asparameter Type="Char" Name="type" Direction="Input" />
<asparameter Type="string" Name="desc" Direction="Input" />
</UpdateParameters>
<InsertParameters>
<asparameter Type="Char" Name="Type" />
<asparameter Type="string" Name="Desc" />
</InsertParameters>
</asp:ObjectDataSource
public override void updatePhoneType(int id, char type, string desc)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("UpdatePhoneType", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;
cmd.Parameters.Add("@type", SqlDbType.NChar).Value = type;
cmd.Parameters.Add("@desc", SqlDbType.NVarChar).Value = desc;
cn.Open();
cmd.ExecuteNonQuery();
}
}
it complains about @desc, but I guess this problem is for @type also
any suggestions?