[求助]ADODB.Field (0x800A0BCD)BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录

eleven571 2008-03-12 09:58:13
郁闷了~一点儿不会~麻烦高手给看一下
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include virtual="/Connections/conn.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' *** Redirect if username exists
MM_flag = "MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
Dim MM_rsKey
Dim MM_rsKey_cmd

MM_dupKeyRedirect = "/memberadd.asp?errMsg=帐号已经有人使用,请重新输入"
MM_dupKeyUsernameValue = CStr(Request.Form("stu_name"))
Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
MM_rsKey_cmd.ActiveConnection = MM_conn_STRING
MM_rsKey_cmd.CommandText = "SELECT UserName FROM [User] WHERE UserName = ?"
MM_rsKey_cmd.Prepared = true
MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 200, 1, 20, MM_dupKeyUsernameValue) ' adVarChar
Set MM_rsKey = MM_rsKey_cmd.Execute
If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
' the username was found - can not add the requested username
MM_qsChar = "?"
If (InStr(1, MM_dupKeyRedirect, "?") >= 1) Then MM_qsChar = "&"
MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
Response.Redirect(MM_dupKeyRedirect)
End If
MM_rsKey.Close
End If
%>
<%
If (CStr(Request("MM_insert")) = "form3") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conn_STRING
MM_editCmd.CommandText = "INSERT INTO [User] (UserName, Password, nickname, Sex, Email, cellphone, Phone) VALUES (?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, -1, Request.Form("stu_name")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, -1, Request.Form("stu_psw")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, -1, Request.Form("stu_nick")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, -1, Request.Form("stu_sex")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, -1, Request.Form("stu_email")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, -1, Request.Form("stu_cellphone")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, -1, Request.Form("stu_phone")) ' adLongVarChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "/edumain.asp?addMsg=注册成功,转到主页面"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
...全文
544 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mapleleaf123 2008-03-14
  • 打赏
  • 举报
回复
SELECT UserName FROM [User] WHERE UserName = '"&您接收的变量&"'

//PS,是不是用DW生成的````
eleven571 2008-03-12
  • 打赏
  • 举报
回复
那要怎么表达啊~不会
  • 打赏
  • 举报
回复
MM_rsKey_cmd.CommandText = "SELECT UserName FROM [User] WHERE UserName = ?"

?这样表达?
木头是猫 2008-03-12
  • 打赏
  • 举报
回复
不是很明白你要表达什么 =。=

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧