Save Button Background Coding in easy way to get It...............
private void BtnSave_Click(object sender, EventArgs e)
{
string str="Insert into Registration(SNO,NAME,GENDER,DOB,AGE) values('"+TxtSno.Text +"','"+TxtName.Text +"','"+TxtGender.Text +"','"+TxtDob.Text +"','"+TxtAge.Text +"')";
try
{
con.Open();
SqlCommand cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();
TxtAge.Text = TxtDob.Text = TxtGender.Text = TxtName.Text = TxtSno.Text = "";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if (con != null)
{
con.Close();
}
}
}
No comments:
Post a Comment