日期:2014-05-18 浏览次数:20986 次
foreach (int row in RowIndex) { if (row >= 0) { string partid = dgv_UserManage.Rows[row].Cells[1].Value.ToString(); string logid = dgv_UserManage.Rows[row].Cells[2].Value.ToString(); string pass = dgv_UserManage.Rows[row].Cells[3].Value.ToString(); string name = dgv_UserManage.Rows[row].Cells[4].Value.ToString(); string sql = string.Format("update UDP_User set User_Name='{0}',User_Pass='{1}',User_PartId='{2}' where User_LogId='{3}'", name, pass, partid, logid); SqlHelper.sqlExcute(sql); } }
string partid = Convert.ToString(dgv_UserManage.Rows[row].Cells[1].Value); string logid = Convert.ToString(dgv_UserManage.Rows[row].Cells[2].Value); string pass = Convert.ToString(dgv_UserManage.Rows[row].Cells[3].Value); string name = Convert.ToString(dgv_UserManage.Rows[row].Cells[4].Value); //......
------解决方案--------------------
dgv_usermanage.rows[row].Cells["用列明不可以吗?不用考虑下标是不是超出界限"].value