紧急求救:存储过程,工作要用,我实在没有办法了!
内容如下:
sp_c存储过程:
CREATE proc sp_c
@tablename varchar(50),
@title varchar(300)
as
if @tablename='Product'
select count(*) from Product where P_Name like '%'+@title+'%'
GO
-------------------------------------------------------------------
sp_search存储过程:
CREATE PROCEDURE sp_search
@tablename varchar(50),
@title varchar(250),
@pagesize int,
@page int
AS
if @tablename='Product'
begin
declare @str varchar(200)
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[temp_table91]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
————————————————————————————————————
asp调用页面:
<!--#include virtual="/Public/Connect.asp"-->
<%
line=6
if request("page")="" then
page=1
else
page=request("page")
end if
if page<1 then
page=1
end if
'title=trim(request("title"))
title="M"
'list2_id=trim(request("list2_id"))
set rs2=conn.execute("sp_c 'Product','"&title&"'")
pagecount=CInt(rs2(0)\line)
if(CInt(rs2(0)) mod line)=0 then
pagecount=pagecount
else
pagecount=pagecount+1
end if
if CInt(page)>=pagecount then
page=CInt(pagecount)
end if
str=""
str=str&"page="&page&"&title="&title&""
xxx=rs2(0)
rs2.close
set rs2=nothing
set rs=conn.execute("sp_search 'Product','"&title&"','"&line&"','"&CInt(page)&"'")
if rs.eof then
response.write "no record"
else
%>
<html>
<head>
<style type="text/css">
td{font-size:12px;}
a{text-decoration:none;}
</style>
<script language="javascript">
</script>
</head>
<body>
<table width="518" border="1"align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr bgcolor=#dfdfdf>
<td width="454" align="center" height=24 valign="middle">口试题的题目</td>
<td width="63" align="center" valign="middle">删除</td>
</tr>
<% do while not rs.eof %>
<tr height=22>
<td valign="middle">·<a href=void(0)"
onclick="window.open('editkoushi.asp?id=<%=rs("P_ID")%>&page=<%=page%>&title=<%=title%>','','width=518 height=160 left=100')">
<%=rs("P_Name")%></a></td>
<td align="center" valign="middle">删除</td>
</tr>
<%
rs.movenext
loop
%>
<tr align="left" valign="middle" bgcolor="#efeff6" height=22>
<td colspan="2" style="padding-left:6px;">
<a href="search_koushi.asp?page=<%=1%>&title=<%=title%>">首页</a> <a
href="search_koushi.asp?page=<%=page-1%>&title=<%=title%>">上一页</a> <a
href="search_koushi.asp?page=<%=page+1%>&title=<%=title%>">下一页</a> <a
href="search_koushi.asp?page=<%=pagecount%>&title=<%=title%>">末页</a>
一共 <%=pagecount%> 页 当前页为: <%=page%>/<%=pagecount%> 页
共有 <%=xxx%> 条记录</td>
</tr>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
end if
%>
————————————————————————————————————————————
错误如下:
ADODB.Recordset 错误 '800a0e78'
对象关闭时,不允许操作。
/search.asp,行40
begin
select * into temp_table91 from Product where P_Name like '%'+@title+'%' order by P_ID desc
set rowcount @pagesize
set @str='select * from temp_table91 where P_ID not in
(select P_ID from temp_table91)'
drop table temp_table91
end
end
GO