我在ASP中使用command.commandtext来调用存储过程(SQL)失败,出现错误。
进入visual interdev环境,消息提示;
an object has failed to load. the object will be displayed as text
代码如下(简单)
Dim conn, rs,cmd
set conn=server.CreateObject("adodb.connection")
conn.open"driver={SQLSERVER};server=localhost;uid=sa;pwd=;database=ALLMAPSOFT;"
set cmd=server.CreateObject ("adodb.command")
set cmd.ActiveConnection =conn
set cmd.CommandText="manatemptable"--此行错误!manamtemptable 是我在 allmapsoft中定义的存储过程!
set rs=cmd.Execute
另外:存储过程定义中,最后一行能使用SELECT语句将结果集给RS吗?不能,要怎么做?
CREATE Procedure dbo.manatemptable
As
...........................
..........................
select * from allmapsaletemptable
GO
---------------------------------------------------------------
前面的可以,但也许你在过程里要写
CREATE Procedure dbo.manatemptable
As
SET NOCOUNT ON
...........................
..........................
SET NOCOUNT OFF
select * from allmapsaletemptable
GO