主题:[讨论]为什么换一种添加记录的方式就不行了呢?
我作的登录并添加记录的网页。但是,用insertsql方式能添加。但改用AddNew FieldList, ValueList怎么就不行了呢?想请教各位看看。代码如下:
<%
Dim FieldList, ValueList
if Request.Form("action")="true" then
recordtime=trim(request.form("Now"))
username=trim(Request.Form("username")) '登录用户名
password=trim(Request.Form("password")) '登录密码
otherpwd = Trim(Request.form("otherpwd")) '附加码
reotherpwd = Trim(Request.form("reotherpwd"))'生成的附加码
legalTag=checkenter()
If legalTag=TRUE then '如果没有非法输入,则进行用户验证
if otherpwd = reotherpwd then '附加码比较
legalUserTag=checksysUser() '系统用户验证
if legalUserTag=true then
If Session("level")=1 and Session("admin")="True" Then
Response.Redirect("manage.asp")
Response.End
End If
If Session("level")=2 Then
Response.Redirect("main.asp")
Response.End
End If
If Session("level")=3 Then
' 注释:使用记录集来添加新记录
If Request("username") <> ""Then
' 注释:设置新增记录的字段和值
FieldList = Array("user","recordtime","note")
ValueList = Array(Request("username"),Request("Now"))
' 注释:连接数据库并插入新记录
Set objRS = Session("objRS")
objRS.LockType = 2
objRS.Open "logintable"
objRS.AddNew FieldList, ValueList
objRS.Close
Set objRS = Nothing
Response.Redirect("normal.asp")
Response.End
End If
下略
%>
<%
Dim FieldList, ValueList
if Request.Form("action")="true" then
recordtime=trim(request.form("Now"))
username=trim(Request.Form("username")) '登录用户名
password=trim(Request.Form("password")) '登录密码
otherpwd = Trim(Request.form("otherpwd")) '附加码
reotherpwd = Trim(Request.form("reotherpwd"))'生成的附加码
legalTag=checkenter()
If legalTag=TRUE then '如果没有非法输入,则进行用户验证
if otherpwd = reotherpwd then '附加码比较
legalUserTag=checksysUser() '系统用户验证
if legalUserTag=true then
If Session("level")=1 and Session("admin")="True" Then
Response.Redirect("manage.asp")
Response.End
End If
If Session("level")=2 Then
Response.Redirect("main.asp")
Response.End
End If
If Session("level")=3 Then
' 注释:使用记录集来添加新记录
If Request("username") <> ""Then
' 注释:设置新增记录的字段和值
FieldList = Array("user","recordtime","note")
ValueList = Array(Request("username"),Request("Now"))
' 注释:连接数据库并插入新记录
Set objRS = Session("objRS")
objRS.LockType = 2
objRS.Open "logintable"
objRS.AddNew FieldList, ValueList
objRS.Close
Set objRS = Nothing
Response.Redirect("normal.asp")
Response.End
End If
下略
%>