急求!!asp调用存储过程代码? 为什么我的代码显示不出来,好像根本没调用存储过程???

wendy1208 2005-09-22 05:58:48
以下是我用的代码,可是好像根本没有调用存储过程,不知道代码有什么问题?希望得到正确的能调用存储过程的方法!

set CmdSP = Server.CreateObject("ADODB.Command")
CmdSP.ActiveConnection ="Provider = Sqloledb; User ID =ss; Password = ss; Initial Catalog = database; Data Source = (local); database=database"
CmdSP.CommandText = "COM_SEARCH"
CmdSP.CommandType = 4
CmdSP.Parameters.Append CmdSP.CreateParameter("@vchXL", 200, 1, 40, request.form("search_xl"))
CmdSP.Parameters.Append CmdSP.CreateParameter("@vchDepart", 200, 1, 80, request.form("search_depart"))'
CmdSP.Parameters.Append CmdSP.CreateParameter("@age", 3, 1, ,request.form("Age"))
Set adoRS = CmdSP.Execute

请大侠们多多帮忙,万分感谢!
...全文
159 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
CREATE PROCEDURE dbo.picdisplay
@foldernum int,
@id int,
@page int,
@totalpage int output
AS
declare @thepage int
declare @pagenum int
declare @sql nvarchar(200)
set @thepage=(@page-1)*4
if @foldernum=0
begin
set @sql='select top 4 * from pic where id='
+cast(@id as nvarchar(30)) +'and thepicid not in
(select top '+cast(@thepage as nvarchar(30))+'
thepicid from pic where id='+cast(@id as nvarchar(30))+'
order by thepicid) order by thepicid'
exec sp_executesql @sql
select @pagenum=count(*) from pic where id=@id

if (@pagenum % 4)=0
begin
select @totalpage=@pagenum/4
end
else
begin
select @totalpage=@pagenum/4+1
end


end
else
if @foldernum=1
begin
set @sql='select top 4 * from pic where id='
+cast(@id as nvarchar(30)) +'and share=1 and thepicid not in
(select top '+cast(@thepage as nvarchar(30))+'
thepicid from pic where id='+cast(@id as nvarchar(30))+' and share=1
order by thepicid) order by thepicid'
exec sp_executesql @sql
select @pagenum=count(*) from pic where id=@id and share=1
if (@pagenum % 4)=0
begin
select @totalpage=@pagenum/4
end
else
begin
select @totalpage=@pagenum/4+1
end
end
else
if @foldernum=2
begin
set @sql='select top 4 * from pic where id='
+cast(@id as nvarchar(30)) +'and foldernum=0 and thepicid not in
(select top '+cast(@thepage as nvarchar(30))+'
thepicid from pic where id='+cast(@id as nvarchar(30))+' and foldernum=0
order by thepicid) order by thepicid'
exec sp_executesql @sql
select @pagenum=count(*) from pic where id=@id and foldernum=0
if (@pagenum % 4)=0
begin
select @totalpage=@pagenum/4
end
else
begin
select @totalpage=@pagenum/4+1
end
end
else
begin
set @sql='select top 4 * from pic where id='
+cast(@id as nvarchar(30)) +'and foldernum='+cast(@foldernum as nvarchar(30))+' and thepicid not in
(select top '+cast(@thepage as nvarchar(30))+'
thepicid from pic where id='+cast(@id as nvarchar(30))+' and foldernum='+cast(@foldernum as nvarchar(30))+'
order by thepicid) order by thepicid'
exec sp_executesql @sql
select @pagenum=count(*) from pic where id=@id and share=1
if (@pagenum % 4)=0
begin
select @totalpage=@pagenum/4
end
else
begin
select @totalpage=@pagenum/4+1
end
end
GO

我的分页存储过程不算很好,你自己看看吧
wendy1208 2005-09-25
  • 打赏
  • 举报
回复
试了,都没什么用。
对了,顺便问一下:存储过程调用后取出的记录集能用AbsolutePage这个属性吗?
如果不能,有什么简单的方法能解决?
多谢!
得到答案后马上结帖~
arrowy 2005-09-23
  • 打赏
  • 举报
回复
CmdSP.ActiveConnection ="Provider = Sqloledb; User ID =ss; Password = ss; Initial Catalog = database; Data Source = (local); database=database"
换成
CmdSP.ActiveConnection = objconn (就是用一个活动的connection对象)

试试呢
tigerwen01 2005-09-23
  • 打赏
  • 举报
回复
CmdSP.Parameters.Append CmdSP.CreateParameter("@age", 3, 1, ,request.form("Age"))
好象多一个,号
wendy1208 2005-09-23
  • 打赏
  • 举报
回复
请大家多帮忙!
自己顶~
wendy1208 2005-09-22
  • 打赏
  • 举报
回复
附加一句,在这个过程中调用的是2个表的数据!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧