anat tap

anat tap

  • NA
  • 1
  • 3.2k

update data from textBox to DataBase

Sep 23 2010 9:06 PM
hello!im trying to update from text box to database. it doesnt work.
this is my code on button click, where im wrong?
         cmd = new SqlCommand("update_pro", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@id", SqlDbType.NChar).Value = TextBoxid1.Text;
            cmd.Parameters.Add("@fname", SqlDbType.NChar).Value = TextBoxfname1.Text;
            cmd.Parameters.Add("@lname", SqlDbType.NChar).Value = TextBoxlname.Text;
            cmd.Parameters.Add("@id_num", SqlDbType.NChar.Value = TextBoxid2.Text;
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();


thank you.




Answers (3)