Hi Initially you will get the by using below code
DataSet ds = new DataSet();
static SqlConnection con = new SqlConnection("user id=sa;password=just4fun;database=sdp;data source=sitt244");
static SqlCommand cmd = new SqlCommand("select * from employee ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
private void GetData()
{
dataGridView1.Visible = true;
da.Fill(ds,"e");
dataGridView1.DataSource = ds.Tables["e"];
MessageBox.Show("You got the data");
}
private void button1_Click(object sender, EventArgs e)
{
GetData();
}
If you want to insert data or save changes then write the below code in "Savechanges" button click
SqlCommandBuilder cmd = new SqlCommandBuilder(da);
try
{
da.Update(ds, "e");
MessageBox.Show("Saved");
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}