ADODB.Recordset 错误“800a0bb9":参数类型错误 [英] ADODB.Recordset error '800a0bb9' : Arguments are of the wrong type

查看:15
本文介绍了ADODB.Recordset 错误“800a0bb9":参数类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Set rsPlanID = Server.CreateObject("ADODB.Recordset")
rsPlanID.CursorLocation = adUseClient

strSQL = "SELECT PlanID FROM ATTJournals WHERE ATTUserDataID = " & ATTUserDataID 
rsPlanID.Open strSQL, m_objConn, adOpenStatic, adLockOptimistic

If Not rsPlanID.EOF Then
    response.Write "New PlanID:"  & rsPlanID("PlanID")
End If

以上代码为经典asp.

The above code is in classic asp.

我收到以下错误:

ADODB.Recordset 错误800a0bb9"
参数类型错误、超出可接受范围或相互冲突.

ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

有谁知道这个错误的原因以及如何解决它?

Dows anyone know the cause this error and how to fix it?

推荐答案

最喜欢的原因是你没有包含ADOVBS.INC"或等价的META:-

The most like cause is that you haven't included "ADOVBS.INC" or the equavalent META:-

<!--METADATA
TYPE="TypeLib"
NAME="Microsoft ActiveX Data Objects 2.6 Library"
UUID="{00000206-0000-0010-8000-00AA006D2EA4}"
VERSION="2.6"
-->

因此 adxxxx 常量不存在.但是,您的主要错误不是在脚本顶部包含 Option Explicit .这将为您节省大量时间寻找愚蠢的错误和拼写错误.

Hence the adxxxx constants do not exist. However your primary mistake is not including Option Explicit at the top your script. This will save you bucket loads of time hunting silly mistakes and typos.

顺便说一句,如果 ATTUserDataID 包含0; DELETE ATTJournals;"会发生什么?
避免像瘟疫一样使用连接来编写 SQL.搜索ASP SQL 注入"以查找使用参数化命令对象的示例.

BTW What happens if ATTUserDataID contained "0; DELETE ATTJournals;" ?
Avoid composing SQL using concatenation like the plague. Search for "ASP SQL Injection" to find examples of using parameterised command objects instead.

这篇关于ADODB.Recordset 错误“800a0bb9":参数类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆