指定的参数已超出有效值的范围. 参数名: index
protectedvoidgdvFMenu_RowUpdating(objectsender,GridViewUpdateEventArgse){SqlConnectio...
protected void gdvFMenu_RowUpdating(object sender, GridViewUpdateEventArgs e) {
SqlConnection sqlcon = new SqlConnection(conn);
string sqlstr1 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
string sqlstr2 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
string sqlstr3 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
string sqlstr4 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
string sqlstr = "update foodMenu set f_Name='" + sqlstr1 + "'f_Type='" + sqlstr2 + "'f_Material='" + sqlstr3 + "'f_Price='" + "'where f_Id='"
+ ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim() + "'";
这段代码怎么改呢 展开
SqlConnection sqlcon = new SqlConnection(conn);
string sqlstr1 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
string sqlstr2 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
string sqlstr3 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
string sqlstr4 = ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
string sqlstr = "update foodMenu set f_Name='" + sqlstr1 + "'f_Type='" + sqlstr2 + "'f_Material='" + sqlstr3 + "'f_Price='" + "'where f_Id='"
+ ((TextBox)(gdvFMenu.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim() + "'";
这段代码怎么改呢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询