ADODB.Command 错误 '800a0bb9' 求帮助
ADODB.Command 错误 '800a0bb9'
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/lr/index.asp,行 24
代码如下:
<%
' *** Redirect if username exists
MM_flag = "MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
Dim MM_rsKey
Dim MM_rsKey_cmd
MM_dupKeyRedirect = "back1.html"
MM_dupKeyUsernameValue = CStr(Request.Form("m_xuehao"))
Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
MM_rsKey_cmd.ActiveConnection = MM_coon_STRING
这里错了
MM_rsKey_cmd.CommandText = "SELECT m_xuehao FROM [表1] WHERE m_xuehao = ?"
MM_rsKey_cmd.Prepared = true
MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 5, 1, -1, MM_dupKeyUsernameValue) ' adDouble
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
%>
coon.asp代码如下:
<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_coon_STRING
'MM_coon_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\兴趣小组作业\asp网站\database\123.mdb"
MM_conn_STRING="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("data/db1.mdb")
%>
本人用的是dreamweaver CS6 测试数据库连接成功
求帮助!!本人感激不尽
------解决方案--------------------MM_rsKey_cmd.ActiveConnection = MM_coon_STRING
MM_coon_STRING 被你注释掉了,没有定义就是空值,是MM_conn_STRING
Dim MM_coon_STRING
'MM_coon_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\兴趣小组作业\asp网站\database\123.mdb"
MM_c
onn_STRING="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("data/db1.mdb")
MM_rsKey_cmd.ActiveConnection = MM_conn_STRING