bb64844866 发表于 2008-12-10 10:03:05

关于在robot下写脚本调用存储过程的问题

在Robot下写脚本连接数据库尝试调用一个简单的存储过程,脚本如下,单步调式到最后一句(红色)时,弹出了提示报错(蓝色),找不到存储过程。。。哪位有经验的人事给指点下,我的存储过程是SQL Server2000的,在其下运行没问题的。。。
sub main
dim conn as object,cmd as object
dim strconn
dim rs as object,cmdtemp as object
const adVarchar=200
const adInteger=3
Const adParamInput = &H0001

set conn=CreateObject("adodb.connection")
strconn="provider=sqloledb;server=(local);initial catlog=dbBooks;user id=sa;password=sql"
conn.Open strconn

set cmd=CreateObject("adodb.command")
set cmd.ActiveConnection=conn
cmd.CommandText="usp_GetTitles"'"{call usp_GetTitles}"
cmd.Parameters.Append cmd.CreateParameter("@filter",adVarChar,adParamInput,4)
cmd("@filter")="test"
cmd.Parameters.Append cmd.CreateParameter("@f2",adInteger,adParamInput )
cmd("@f2")="1"

set rs=cmd.Execute()

end sub

错误信息:Microsoft OLE DB Provider for SQL Server:未能找到存储过程'usp_GetTitles'

附存储过程代码:
CREATE procedure usp_GetTitles
@filter varchar(50),
@f2 varchar(50)
as
select * from tblBooks where booktitle like '%'+@filter+'%' and bookid like '%'+@f2+'%'
GO

[ 本帖最后由 bb64844866 于 2008-12-10 10:04 编辑 ]
页: [1]
查看完整版本: 关于在robot下写脚本调用存储过程的问题