error in the syntax of cmd parameters
Posted
by KATy
on Stack Overflow
See other posts from Stack Overflow
or by KATy
Published on 2010-03-26T13:37:02Z
Indexed on
2010/03/26
13:43 UTC
Read the original article
Hit count: 364
sql
hi guyz in this method i m just adding the values to the db.
temp is a object. the field value and variables in the object re havin the same name..
dono y this error s comin
plz
help me out...
public virtual void Save_input_parameter_details(Test_Unit_BLL temp )
{
SqlConnection con;
con = new SqlConnection("Data Source=VV;Initial Catalog=testingtool;User ID=sa;Password=sa;");
con.Open();
SqlCommand cmd, cmd2, cmd3;
//try
//{
for (int i = 0; i < temp.No_Input_parameters; i++)
{
cmd2 = new SqlCommand("insert into Input_parameter_details values(@Input_Parameter_name,@Input_Parameter_datatype,@noparams,@class_code", con);
cmd2.Parameters.AddWithValue("@Input_Parameter_datatype", temp.Input_Parameter_datatype[i]);
cmd2.Parameters.AddWithValue("@Input_Parameter_name", temp.Input_Parameter_name[i]);
cmd2.Parameters.AddWithValue("@noparams", temp.No_Input_parameters);
cmd2.Parameters.AddWithValue("@class_code",temp.class_code);
cmd2.ExecuteNonQuery();
}
//}
//catch (Exception ex)
// {
// MessageBox.Show("error"+ex);
// }
}
© Stack Overflow or respective owner