代码摘录如下:SqlCommand cmd = new SqlCommand(SQLStr,myConn);
Convert.ToString(TableID);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds,TableName.Text);
ds.Tables[0].Columns.Add("Modified");
ds.Tables[0].RowChanged += new DataRowChangeEventHandler(OnRowChanged);
// 生成列
// 第一列
DataGridTextBoxColumn dcs1 = new DataGridTextBoxColumn();
dcs1.HeaderText = "Field_ID";
dcs1.MappingName = "Field_ID";
dcs1.ReadOnly = true;private void OnRowChanged(object sender, DataRowChangeEventArgs e)
{
e.Row.BeginEdit();
e.Row[8] = "1";
e.Row.EndEdit();
}
麻烦哪位兄弟帮我看一下吧。
Convert.ToString(TableID);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds,TableName.Text);
ds.Tables[0].Columns.Add("Modified");
ds.Tables[0].RowChanged += new DataRowChangeEventHandler(OnRowChanged);
// 生成列
// 第一列
DataGridTextBoxColumn dcs1 = new DataGridTextBoxColumn();
dcs1.HeaderText = "Field_ID";
dcs1.MappingName = "Field_ID";
dcs1.ReadOnly = true;private void OnRowChanged(object sender, DataRowChangeEventArgs e)
{
e.Row.BeginEdit();
e.Row[8] = "1";
e.Row.EndEdit();
}
麻烦哪位兄弟帮我看一下吧。
这一列 是为了判断行中的数据是否有更改,如果更改了,就修改这一列的值为 1,
这种方法不行的话,有什么别的好方法吗,请赐教。
{
e.Row.BeginEdit();
e.Row[8] = "1";
e.Row.EndEdit();
}
加一个条件可以屏蔽死循环了,但是数据集再次打开时,e.Row[8] 都被初始化为1了