"无法绑定由多个部分组成的标识符 "这个问题怎么解决

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string str = GridView1.Rows[e.RowIndex].Cells[1].Controls[0].ToString(); String strsql = "update News_Class set NewsC_Name="+str+" where NewsC_Id=" + GridView1.DataKeys[e.RowIndex].Value.ToString() + ""; baseclass1.execsql(strsql); GridView1.EditIndex = -1; bindgrig(); }“/”应用程序中的服务器错误。无法绑定由多个部分组成的标识符 "System.Web.UI.WebControls.TextBox"。说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 无法绑定由多个部分组成的标识符 "System.Web.UI.WebControls.TextBox"。源错误: 行 89: SqlCommand Comm = new SqlCommand(strSql, Conn);行 90: Conn.Open();行 91: Comm.ExecuteNonQuery();行 92: Conn.Close();行 93:

第1个回答  2013-08-03
string str = GridView1.Rows[e.RowIndex].Cells[1].Controls[0].ToString();->Controls[0].Text.ToString();今天查到这个问题就回复下 虽然是个坟~
第2个回答  2013-08-03
Conn.Open();应该写在SqlCommand Comm = new SqlCommand(strSql, Conn);前面。
第3个回答  2013-08-03
单步调试查看 String strsql 值是多少
相似回答