asp调用存储过程出现错误 "800a0bb9"

王朝c#·作者佚名  2006-12-17
窄屏简体版  字體: |||超大  

create PROCEDURE dbo.sp_InsertSo

(

@cust_name varchar(120)

)

AS

BEGIN

INSERT INTO dbo.so (cust_name)

VALUES (@cust_name)

END

asp:

set cmd=server.CreateObject ("adodb.command")

set cmd.ActiveConnection=conn

cmd.CommandText="{call sp_InsertSo(?)}"

cmd.Parameters.Append cmd.CreateParameter("@cust_name",adInteger,adParamInput)

cmd("@cust_name")="999"

cmd.Execute()

ADODB.Command 错误 '800a0bb9'

参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。

出错行:cmd.Parameters.Append cmd.CreateParameter("@cust_name",adInteger,adParamInput)

用baidu找了半天找不到解决方法,用google搜索英文网站找到:

(a) put <% Option Explicit %> at the top of your code

(b) In case if you have not included, include ADO Type library or ADOVBS.inc at the top of your page.

e.g.

<!-- METADATA TYPE="typelib"

UUID="00000205-0000-0010-8000-00AA006D2EA4"

NAME="ADO 2.5 Type Library"

-->

于是加上:

dim cmd

Dim adCmdSPStoredProc

Dim adParamReturnValue

Dim adParaminput

Dim adParamOutput

Dim adInteger

Dim iVal

Dim oVal

Dim adoField

Dim adVarChar

adCmdSPStoredProc = 4

adParamReturnValue = 4

adParaminput = 1

adParamOutput = 2

adInteger = 3

adVarChar = 200

oVal = 3

执行成功

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航