SqlCommand scd = new SqlCommand("delete from tb_user where UserName=" + UserName, con);
小弟在编写删除数据库某一行的时候出现的情况,提示要删除的那一行的 UserName 列名无效。
高手解决protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConSQL"]);
con.Open();
string UserName = GridView1.DataKeys[e.RowIndex].Value.ToString();
SqlCommand scd = new SqlCommand("delete from tb_user where UserName=" + UserName, con);
scd.ExecuteNonQuery();
this.bind();
}
小弟在编写删除数据库某一行的时候出现的情况,提示要删除的那一行的 UserName 列名无效。
高手解决protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConSQL"]);
con.Open();
string UserName = GridView1.DataKeys[e.RowIndex].Value.ToString();
SqlCommand scd = new SqlCommand("delete from tb_user where UserName=" + UserName, con);
scd.ExecuteNonQuery();
this.bind();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货