string sql = "delete from 用户表 where 用户名=" +GridView1.DataKeys[e.RowIndex].Value.ToString+ "";

2024-11-23 15:52:27
推荐回答(1个)
回答1:

你要先确定GridView1.DataKeys[e.RowIndex].Value.ToString是否获取值,然后试试这样写
string sql = "delete from 用户表 where 用户名='" +GridView1.DataKeys[e.RowIndex].Value.ToString+ "'";