3
Answers

Update to MSSQL database failed.

Cris Abella

Cris Abella

11y
1.5k
1
Hello everybody please consider me as a newbie in C# and I am much willing to learn this language. This is first time I've join the community.
 
why update to mssql database failed.
mssql table
custId = int(autoincrement)
custname = varchar(30) 
 
SqlConnection con = new SqlConnection("Data Source=CRIS-PC\\SQLEXPRESS;Integrated Security=True;Initial Catalog = POS");
SqlCommand command = new SqlCommand("Update customers set custname = @custname where custid = @custId)", con);
command.Parameters.AddWithValue("@custname",txtName.Text);
command.Parameters.AddWithValue("@custId",Convert.ToInt32(txtCustId.Text));
thank in advance. 
Cris 
 
 
 
Answers (3)