为什么我的update更新不了啊
求大家解答 卡几个小时了
int rowindex = dataGridView1.CurrentRow.Index;
string[] value = new string[13];
value[0] = "0";
for (int i = 1; i < 13; i++)
{
value[i] = dataGridView1.Rows[rowin
dex].Cells[i].Value.ToString();
}
int strid2 = Convert.ToInt32(dataGridVie
w1.CurrentRow.Index);
string sql = string.Format(@"update Emp
loyee set EmployeeName='{0}',EmployeeSex='{1}',EmployeeIDCard={2},EmployeeBirth='{3}',EmployeeHire='{4}',EmployeeTitle='{5}',EmployeeDepartment='{6}',EmployeePaid='{7}',EmployeeAddress='{8}',EmployeePostalCode='{9}',EmployeeIphone='{10}',EmployeeRemarks='{11}'wher e EmployeeID ='{12}'"
, value[1], value[2], Convert.ToInt32(value[3]), value[4], value[5], value[6], value[7], value[8], value[9], value[10], value[11], value[12], strid2);
int n = DBHelper.ExecuteNonQuery(sql);
if (n > 0)
{
MessageBox.Show("修改成功");
}
else
{
MessageBox.Show("修改失败");
}
```
你看看数据库是不是已经修改成功了,感觉应该是你的窗体没有刷新数据
报错信息截图出来看看
这三张图片 第一张图片是我根据性别男然后查找到下面的人 但是就是前两个一直是重复的 然后我就点击修改性别嘛 改完了 也提示修改成功了 但是再次查询 却没有修改成功 这是咋回事啊 我也也用了update呜呜