public SqlDataAdapter GetPersonRedeploy(string cPsnNum) {
string selectStr = "select * from person where person.cPsn_Num='" + cPsnNum + "'";
this.sqlC = new SqlConnection(DBOperate.connectStr);
this.sqlCmd = new SqlCommand(selectStr, this.sqlC);
this.sqlC.Open();
this.sqlDa = new SqlDataAdapter(sqlCmd);
return this.sqlDa;
}
SqlDataAdapter sda = dbop.GetPersonRedeploy(dataGridView1.CurrentCell.Value.ToString());
DataTable table = new DataTable();
sda.Fill(table);
bindingSource2.DataSource = table;
dataGridView2.DataSource = bindingSource2;
我从person取出数据,并把它填充到dataGridView2中,dataGridView2中启用删除和编辑,可是要怎么样才能更新数据源呢?
string selectStr = "select * from person where person.cPsn_Num='" + cPsnNum + "'";
this.sqlC = new SqlConnection(DBOperate.connectStr);
this.sqlCmd = new SqlCommand(selectStr, this.sqlC);
this.sqlC.Open();
this.sqlDa = new SqlDataAdapter(sqlCmd);
return this.sqlDa;
}
SqlDataAdapter sda = dbop.GetPersonRedeploy(dataGridView1.CurrentCell.Value.ToString());
DataTable table = new DataTable();
sda.Fill(table);
bindingSource2.DataSource = table;
dataGridView2.DataSource = bindingSource2;
我从person取出数据,并把它填充到dataGridView2中,dataGridView2中启用删除和编辑,可是要怎么样才能更新数据源呢?
=====看看秋枫的Blog