指定的参数已超出有效值的范围。 参数名: index
protectedvoidGridView1_RowUpdating(objectsender,GridViewUpdateEventArgse){intid=int.P...
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
string a = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString();
string b = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString();
string c = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString();
conn.Open();
OleDbCommand cmd = new OleDbCommand("update radio set classification='" + a + "', radio='" + b + "', url='" + c + "' where ID=" + id, conn);
cmd.ExecuteNonQuery();
conn.Close();
GridView1.EditIndex = -1;
dataBind();
}
后台更新数据时就出现错误,在string c这块就过不去了,请高手帮忙 展开
{
int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
string a = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString();
string b = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString();
string c = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString();
conn.Open();
OleDbCommand cmd = new OleDbCommand("update radio set classification='" + a + "', radio='" + b + "', url='" + c + "' where ID=" + id, conn);
cmd.ExecuteNonQuery();
conn.Close();
GridView1.EditIndex = -1;
dataBind();
}
后台更新数据时就出现错误,在string c这块就过不去了,请高手帮忙 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询