主题:这里有一段代码!!莫名其妙的错误!!求救!!
我在DataGrid中作了一个编辑功能,可以修改数据表的数据,另外还做了删除,全选,功能,但是编辑功能不可用,每次在浏览器里访问时都会报错,但是其他功能都正常
代码如下,请大家帮忙给看一下:
sub DataGrid1_Update(sender as object,e as DataGridCommandEventargs)
dim conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("dat/jfxt.mdb"))
conn.open()
dim strSql as string
dim sqjbname,jbname,fenshuname as textbox
sqjbname=e.item.cells(4).controls(0)
jbname=e.item.cells(5).controls(0)
fenshuname=e.item.cells(6).controls(0)
strSql="Update studentfenshu set sqleibie = '" & sqjbname.text & "',sqjb='"& jbname.text &"' ,fenshu=" & CInt(fenshuname.text) & " where sqsj =" & DataGrid1.DataKeys(CInt(e.item.itemindex))
dim cmd as new OleDbCommand(strSql,conn)
cmd.ExecuteNonQuery()
conn.close()
DataGrid1.edititemindex=-1
call BindData()
end sub
每次运行都会如下错误:
Server Error in '/' Application.
________________________________________
至少一个参数没有被指定值。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。
Source Error:
Line 41: dim cmd as new OleDbCommand(strSql,conn)
Line 42:
Line 43: cmd.ExecuteNonQuery()
Line 44: conn.close()
Line 45: DataGrid1.edititemindex=-1
Source File: D:\xitonghtgl\teacher_admin_student_right.aspx Line: 43
[size=4]请高手指教!!![/size]
代码如下,请大家帮忙给看一下:
sub DataGrid1_Update(sender as object,e as DataGridCommandEventargs)
dim conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("dat/jfxt.mdb"))
conn.open()
dim strSql as string
dim sqjbname,jbname,fenshuname as textbox
sqjbname=e.item.cells(4).controls(0)
jbname=e.item.cells(5).controls(0)
fenshuname=e.item.cells(6).controls(0)
strSql="Update studentfenshu set sqleibie = '" & sqjbname.text & "',sqjb='"& jbname.text &"' ,fenshu=" & CInt(fenshuname.text) & " where sqsj =" & DataGrid1.DataKeys(CInt(e.item.itemindex))
dim cmd as new OleDbCommand(strSql,conn)
cmd.ExecuteNonQuery()
conn.close()
DataGrid1.edititemindex=-1
call BindData()
end sub
每次运行都会如下错误:
Server Error in '/' Application.
________________________________________
至少一个参数没有被指定值。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: 至少一个参数没有被指定值。
Source Error:
Line 41: dim cmd as new OleDbCommand(strSql,conn)
Line 42:
Line 43: cmd.ExecuteNonQuery()
Line 44: conn.close()
Line 45: DataGrid1.edititemindex=-1
Source File: D:\xitonghtgl\teacher_admin_student_right.aspx Line: 43
[size=4]请高手指教!!![/size]