GridView更新出错
再使用GridView更新操作在 st_comm.Parameters[ "@Student_home "].Value = st_st_colvalue;时出错提示st_comm.Parameters[ "@Student_home "].Value : “st_comm.Parameters[ "@Student_home "]”引发“System.IndexOutOfRangeException”类型的异常,请帮帮忙谢谢
代码:
//更新
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow gvr=this.GridView1.Rows[e.RowIndex];
//创建命令字符
SqlCommand st_comm = new SqlCommand( "update_student_1 ",st_conn);
//指定为调用存储过程
st_comm.CommandType = CommandType.StoredProcedure;
try
{
//添加数据参数
st_comm.Parameters.Add(new SqlParameter( "@Student_name ", SqlDbType.VarChar,50));
st_comm.Parameters.Add(new SqlParameter( "@Student_sex ", SqlDbType.Char, 10));
st_comm.Parameters.Add(new SqlParameter( "@Student_nation ",SqlDbType.Char,10));
st_comm.Parameters.Add(new SqlParameter( "@Student_birthday ", SqlDbType.DateTime, 8));
st_comm.Parameters.Add(new SqlParameter( "@Student_time ", SqlDbType.DateTime, 8));
st_comm.Parameters.Add(new SqlParameter( "@Student_classid ", SqlDbType.VarChar, 50));
st_comm.Parameters.Add(new SqlParameter( "Student_home ", SqlDbType.VarChar, 50));
st_comm.Parameters.Add(new SqlParameter( "Student_else ", SqlDbType.VarChar, 50));
st_comm.Parameters.Add(new SqlParameter( "Student_id ", SqlDbType.BigInt, 8));
&n