can anyone tell me what's the wrong in the code.............when i run this........the updation is not working
string sq1;
SqlCommand cmd1;
SqlDataReader rd1;
SqlConnection cn;
cn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=J:\\Rcar\\motion\\db_image.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
cn.Open();
sq1= "SELECT * FROM Customers";
cmd1 = new SqlCommand(sq1,cn);
rd1 = cmd1.ExecuteReader();
//while (rd1.Read())
// {
//Console.WriteLine(String.Format("{0} {1}", dataReader["CompanyName"], dataReader["ContactName"]));
// }
rd1.Close();
sq1 = "UPDATE users SET username = '" + Box.Text + "',userid='" + Box2.Text + "',password='" + Box3.Text + "',sex='" + Box4.Text + "',email='" + Box5.Text + "' WHERE userid = '" + Box1.Text + "'";
cmd1 = new SqlCommand(sq1, cn);
cmd1.ExecuteNonQuery();
cn.Close();