create proc info
@topsl int
as
declare @s varchar(5000)
begin
set @s='SELECT top '+@topsl+' * from users order by id desc'
exec (@s)
end
go
前台调用:
set rs = server.createobject("adodb.recordset")
rs.Open " exec info 5",conn,1,1
以上代码无法运行,
但是下面这种情况就能通行:
create proc info
as
declare @s varchar(5000)
begin
set @s='SELECT top 7 * from users order by id desc'
exec (@s)
end
go
前台调用:
set rs = server.createobject("adodb.recordset")
rs.Open " exec info ",conn,1,1
为什么加了个top变量就不行了呢??我那里有错误吗???
最新问题:
create proc info
@rdp varchar(50),
@topsl varchar
as
declare @s varchar(5000)
begin
set @s='SELECT top '+@topsl+' * from users where rdp= '+@rdp+' order by id desc'
exec (@s)
end
go
前台调用:
dim rdp
rdp="北京"
set rs = server.createobject("adodb.recordset")
rs.Open " exec info '"&rdp&"','5'",conn,1,1
top是对了,但加了个条件又不行了,我开始是有条件的没有top就通行了,现在有条件又有top怎么又不行了
[此贴子已经被作者于2007-4-18 8:16:48编辑过]