V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
442091317
V2EX  ›  问与答

求助:asp写不进数据库.

  •  
  •   442091317 · 2011-06-14 22:44:10 +08:00 · 5081 次点击
    这是一个创建于 4904 天前的主题,其中的信息可能已经有所发展或是发生改变。
    想写个注册页,出现了这个错误。数据库权限改好了。
    错误类型:
    Microsoft JET Database Engine (0x80040E10)
    参数 ?_4 没有默认值。
    /member.asp, 第 55 行
    第55行:MM_editCmd.Execute
    求解。
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!--#include file="Connections/member.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 = "successerror,asp"
    MM_dupKeyUsernameValue = CStr(Request.Form("member_id"))
    Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
    MM_rsKey_cmd.ActiveConnection = MM_member_STRING
    MM_rsKey_cmd.CommandText = "SELECT member_id FROM member WHERE member_id = ?"
    MM_rsKey_cmd.Prepared = true
    MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 200, 1, 50, 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")) = "form1") Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_member_STRING
    MM_editCmd.CommandText = "INSERT INTO member (member_id, member_pw, member_name, member_sex, member_email, member_qm) VALUES (?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("member_id")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("member_pw")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("member_name")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("member_sex")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 50, Request.Form("member_email")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 50, Request.Form("member_qm")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "membersuccess.asp"
    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
    %>
    <%
    Dim member
    Dim member_cmd
    Dim member_numRows

    Set member_cmd = Server.CreateObject ("ADODB.Command")
    member_cmd.ActiveConnection = MM_member_STRING
    member_cmd.CommandText = "SELECT * FROM member"
    member_cmd.Prepared = true

    Set member = member_cmd.Execute
    member_numRows = 0
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    body {
    background-color: #999999;
    }
    -->
    </style></head>

    <body>
    <form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
    <p>注册_必填</p>
    <p>帐号:
    <input name="member_id" type="text" id="member_id" size="20" />
    仅限英语和数字</p>
    <p>密码:
    <input name="member_pw" type="text" id="member_pw" size="20" />
    (不少于6位)</p>
    <p>注册_选填</p>
    <p>昵称:
    <input name="member_name" type="text" id="member_name" size="20" />
    </p>
    <p>性别:男
    <input type="radio" name="member_sex" id="radio" value="男" />

    <input type="radio" name="member_sex" id="radio2" value="女" />
    </p>
    <p>E-mail:
    <input name="member_email" type="text" id="member_email" size="20" />
    </p>
    <p>QQ/MSN:
    <input name="member_qm" type="text" id="member_qm" size="20" />
    </p>
    <p>
    <input type="submit" name="button" id="button" value="注册" />
    <input name="button2" type="reset" id="button2" value="重置" />
    </p>

    <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <p>&nbsp;</p>
    </body>
    </html>
    <%
    member.Close()
    Set member = Nothing
    %>
    5 条回复    1970-01-01 08:00:00 +08:00
    xhinking
        1
    xhinking  
       2011-06-14 22:50:40 +08:00
    是不是DW生成的代码?
    442091317
        2
    442091317  
    OP
       2011-06-14 22:52:54 +08:00
    用Dreamweaver生成的,没学过asp语法。
    darasion
        3
    darasion  
       2011-06-14 23:05:37 +08:00
    别用A爱死屁了。。。囧。
    442091317
        4
    442091317  
    OP
       2011-06-14 23:12:10 +08:00
    别BS我,只是业余爱好,学下网页设计
    442091317
        5
    442091317  
    OP
       2011-06-14 23:22:23 +08:00
    换个教程,弄成功了,虽然不知道原来的错误出在哪里?嘻嘻
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2194 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 01:31 · PVG 09:31 · LAX 17:31 · JFK 20:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.