我是多表更新
不能用自动生成SQL命令
所以自己写的SQL命令
下面是保存按钮单击事件里的代码                foreach(DataGridViewRow row in dataGridView1.Rows)
                {
                    string sqlstr1 = "update doctor set doc_name='" + row.Cells[1].Value.ToString() + "',sex='" + row.Cells[2].Value.ToString() + "',departmentid=(select ID from department where dm_name='" +row.Cells[3].Value.ToString() + "') where ID='" +row.Cells[0].Value.ToString() + "'";
                    da.UpdateCommand = new SqlCommand(sqlstr1, sa.DoCon());
                    da.Update(ds.Tables[0]);
                }
现在的问题是如果我同时更改两行内容,再点保存,只有第一行更新了,循环貌似不起作用
我新手,请高手解答