J
Jubilee zai
Guest
"public static int updatestrecord(String St_name, String St_fname, String Address, int Contact_no, int Student_id)
{
String query= "update St_record set St_name='" + St_name+ "',St_fname='"+St_fname+"',Address='"+Address+"',Contact_no='"+Contact_no+"' where Student_id='"+Student_id+"'";
OleDbCommand com= new OleDbCommand(query,conn);
int rows = com.ExecuteNonQuery();
return rows;
}"this is a database class code for update button ".
and thats a button code of update "
private void update_Click(object sender, EventArgs e)
{
int Student_id = Int32.Parse(textBox1.Text);
String St_name = textBox2.Text;
String St_fname = textBox3.Text;
String Address = textBox4.Text;
int Contact_no = Int32.Parse(textBox5.Text);
int row = Databaseconn.updatestrecord(St_name,St_fname,Address,Contact_no,Student_id);
if (row > 0)
{
MessageBox.Show("record updated");
}
else MessageBox.Show("error");
}
Continue reading...
{
String query= "update St_record set St_name='" + St_name+ "',St_fname='"+St_fname+"',Address='"+Address+"',Contact_no='"+Contact_no+"' where Student_id='"+Student_id+"'";
OleDbCommand com= new OleDbCommand(query,conn);
int rows = com.ExecuteNonQuery();
return rows;
}"this is a database class code for update button ".
and thats a button code of update "
private void update_Click(object sender, EventArgs e)
{
int Student_id = Int32.Parse(textBox1.Text);
String St_name = textBox2.Text;
String St_fname = textBox3.Text;
String Address = textBox4.Text;
int Contact_no = Int32.Parse(textBox5.Text);
int row = Databaseconn.updatestrecord(St_name,St_fname,Address,Contact_no,Student_id);
if (row > 0)
{
MessageBox.Show("record updated");
}
else MessageBox.Show("error");
}
Continue reading...