con.Open(); string s = "select * from " + U_name.Text + " where Physics_Topic= '" + grdTopicname.Text + "'"; SqlCommand cmd = new SqlCommand(s, con); cmd.Connection = con; SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { string s1 = "UPDATE " + U_name.Text + " SET ID_Physics=@ID_Physics,Physics_Topic=@Physics_Topic,Physics_score=@Physics_score)"; SqlCommand cmd1 = new SqlCommand(s1, con); cmd1.Parameters.AddWithValue("@ID_Physics", grdID.Text); cmd1.Parameters.AddWithValue("@Physics_Topic", grdTopicname.Text); cmd1.Parameters.AddWithValue("@Physics_score", Result.Text); try { cmd1.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Error" + ex.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)