I have a form that include : 2 Textedit
one for input Identifier_number and another to input prod_name
1 lookUpEdit
to select prod_cat from database
1 MemoEdit
to input prod_desc
1 pictureedit
to input the pic
2 simplebutton
one for save data to database and another to fetch the pic
Note Im using tool from devexpress
I want the user input data and the program save it in data base this my code
private void btn_done_Click(object sender, EventArgs e)
{
String sql = "insert into prodects_tab (prod_id,Identifier_number,prod_name,prod_cat,prod_desc)"
+ "Values(@prod_id,@Identifier_number,@prod_name,@prod_cat,@prod_desc)";
using (SqlConnection cn = new SqlConnection(@"Server=.\SQLEXPRESS; Database=db_LPS_Supermarket; Integrated Security=true"))
{
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cmd.Parameters.Add("@prod_id", SqlDbType.Int).Value = 3;
cmd.Parameters.Add("@Identifier_number", SqlDbType.BigInt).Value = txt_sri_num.Text;
cmd.Parameters.Add("@prod_name", SqlDbType.VarChar).Value = txt_prod_name.Text;
cmd.Parameters.Add("@prod_cat", SqlDbType.Int).Value = cmb_Cat.Text;
cmd.Parameters.Add("@prod_desc", SqlDbType.VarChar).Value = txt_prod_desc.Text;
// cmd.Parameters.Add("@prod_pic", SqlDbType.Image).Value = pics_prod_img;
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
}
}
}
the error is in method ExecuteNonQuery()
and if anyone know how i can fatch the pic from picedit to database tell me