SqlConnection con = new SqlConnection("Data source=.;Database=training;
integrated security =true");
DataSet ds = new DataSet();
SqlDataAdapter da;
private void Form1_Load(object sender, EventArgs e)
{
cmd = new SqlCommand("select * from mangers",con);
da = new SqlDataAdapter(cmd );
da.Fill(ds, "1");
dataGridView1.DataSource = ds.Tables[0];
}
private void button1_Click(object sender, EventArgs e)
{
SqlCommandBuilder cmdb = new SqlCommandBuilder(da);
da.Update(ds, "1");
}
我想知道我是否可以在DataGridView
中插入/删除/更新,然后使用存储过程对数据库进行相同的操作?