After saving you have to refresh your table.
private void Form1_Load(object sender, EventArgs e)
{
RefreshData();
}
private void RefreshData()
{
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\manish\Documents\HRM.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
conn.Open();
SqlCommand command = new SqlCommand("select * from emp_detail", conn);
SqlDataAdapter adp = new SqlDataAdapter(command);
adp.Fill(tbl);
display(tbl);
}
private void button4_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\manish\Documents\HRM.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
conn.Open();
SqlCommand command = new SqlCommand();
command.CommandText = "insert into emp_detail(empid,name,surname,fathername,dob,gender,city,contactno,doj,department,designation,qualification,address,remarks) values('" + txtempid.Text + "','" + txtname.Text + "','" + txtsurname.Text + "','" + txtfathername.Text + "','" + dtdob.Text + "','" + cbgender.Text + "','" + cbcity.Text + "','" + txtcontactno.Text + "','" + dtdoj.Text + "','" + txtdept.Text + "','" + txtdesig.Text + "','" + txtqualification.Text + "','" + rtaddress.Text + "','" + rtremarks.Text + "')";
command.Connection = conn;
command.ExecuteNonQuery();
MessageBox.Show("Saving is done!");
RefreshData();
}