<!--#include file="ADOVBS.INC"-->
<%
Dim objConn
Function GetRecordset(FileName,TableName)
'打开数据库连接
Set objConn=Server.CreateObject("adodb.Connection")
objConn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Data Source="&Server.MapPath("student.mdb")
objConn.Open
'从表读取记录并存放在Recordset对象
Set GetRecordset=Server.CreateObject("adodb.Recordset")
GetRecordset.Open "studentin",objConn,adOpenKeyset,_
adLockOptimistic,adCmdTable
End Function
%>'adofunction.asp
<html>
<body>
<!--#include file="adofunction.asp"-->
<%
sz = "'"&Request.Form("userid")&"','"&Request.Form("username")&_
"','"&Request.Form("usergrade")&"','"&Request.Form("userclass")&_
"','"&Request.Form("userpwd")&"'"
Dim objRS
Set objRS = GetRecordset("student.mdb","studentin")
into_db="INSERT INTO studentin(学号,姓名,年级,班级,密码) VALUES(" &_
sz & ")"
objConn.Execute(into_db)
objConn.Close
Set objConn = Nothing
%>
注册成功
</body>
</html>
高手指教,用这两段程序往数据库写入数据时提示错误:
操作必须使用一个可更新的查询
该如何改啊?
參考答案:权限everyone可写~即可~