|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
专业性的服务。有的ASP商提供垂直型的应用服务,针对某一特定行业提供应用服务。server|存储进程|分页 CREATE PROCEDURE [dbo].[Select_page_data_allow_fields_cond]
@allow_fields varchar(100) =" * ",
@DefRecordNum int =20,
@PageNo int =1,
@Where varchar(500) = null
AS
declare @R_end int
declare @S_sql varchar(500)
declare @condition varchar(500)
declare @condition2 varchar(500)
--if rtrim(@Where)!=""
--if rtrim(@Where)!=""
SET @r_end=(@PageNo-1)*@DefRecordNum+1
--正则页码
IF ( CAST(@r_end AS INT)<1)
SET @r_end = 1
SET @Where=rtrim(@Where)
--if not (@Where is null )
if (@Where <>'' )
SET @S_sql="SELECT TOP "+CAST(@DefRecordNum AS CHAR(4)) +space(2)+@allow_fields+" FROM BBSReply WHERE id>=(SELECT MAX(ID) AS r_begin FROM (SELECT TOP "+CAST(@R_end AS CHAR(5))+" ID FROM BBSReply WHERE "+@Where+" ORDER BY ID) airzen) AND "+@Where+" order by id"
ELSE
SET @S_sql="SELECT TOP "+CAST(@DefRecordNum AS CHAR(4)) +space(2)+@allow_fields+" FROM BBSReply WHERE id>=(SELECT MAX(ID) AS r_begin FROM (SELECT TOP "+CAST(@R_end AS CHAR(5))+" ID FROM BBSReply ORDER BY ID) airzen) order by id"
--PRINT @S_sql
EXEC(@S_sql)
GO
---------------------------------------------------
<%
'********************************************************************
'本法式由AIRZEN 2004/5/12 更新修定。
'===================================================================
Option Explicit
'Response.Flush
Dim BeginTime,EndTime
BeginTime=Timer
Dim conn,SQLstr,Rs,DefRecordNum,CursorBegin,CursorEnd,CurPageNum,hav
DefRecordNum=20
dim R_end
'--------------获得相干参数----------
If Request("CurPageNum")<>"" Then
CurPageNum=CLng(Request("CurPageNum"))
If CurPageNum<=0 Then CurPageNum=1
Else
CurPageNum=1
End If
'----------------End-----------------
'------------显示翻页内容函数--------
Function TurnPageFS(DispRecordNum)
Dim n
While Not(Rs.Eof) And n<DispRecordNum
n=n+1
Response.Write "<tr>"&_
"<td bgcolor='efefef'>"&n&"</td>"&_
"<td bgcolor='efefef'>"&Rs(0)&"</td>"&_
"<td bgcolor='efefef'>"&Rs(1)&"</td>"&_
"<td bgcolor='efefef'>"&Rs(2)&"</td>"&_
"<td bgcolor='efefef'>"&Rs(3)&"</td>"&_
"<td bgcolor='efefef'>"&Rs(4)&"</td>"&_
"<td bgcolor='efefef'>"&Rs(5)&"</td>"&_
"</tr>"
If n=1 Then CursorBegin=Rs(0)
If n=DefRecordNum Or Rs.Eof Then CursorEnd=Rs(0)
Rs.MoveNext
Wend
End Function
'-------------毗连数据库-------------
Set conn=Server.CreateObject("Adodb.Connection")
'SQLstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("mldata.mdb")
SQLstr="provider=SQLOLEDB;server=(local);database=XX;uid=XX;pwd=XX;"
conn.Open SQLstr
Dim TotalRecords,TotalPages
TotalPages=clng(request.QueryString("TotalPages"))
'//判别有没有吸收的页码
if TotalPages=0 or not isnumeric(TotalPages) then '//无吸收页码
SQLstr="Select count(ID) As RecordSum From BBSreply WHERE userid='airzen'" '//此前提应与上面的存储进程前提坚持一持
Set Rs=conn.Execute(SQLstr,0,1)
TotalRecords=Rs("RecordSum")
TotalPages=Abs(Int(TotalRecords/DefRecordNum*(-1)))
Rs.Close
Set Rs=Nothing
end if
dim allow_fields
'//答应掌握选择的字段以最优化的SQL 语句履行,
'//allow_fields :答应的字段
'//DefRecordNum :每页显示的纪录数量
'//CurPageNum :以后页码
allow_fields="
[*]"
if TotalPages<1 then TotalPages=1
SQLstr="Select_page_data_allow_fields_cond "&allow_fields&","&DefRecordNum&","&CurPageNum&",[userid='airzen']"
'//此处的前提应与下面的坚持分歧
'//SQLstr="Select_page_data_allow_fields_cond "&allow_fields&","&DefRecordNum&","&CurPageNum&",[ id=1449236]"
response.write "<br>"&SQLstr
Set Rs=conn.Execute(SQLstr)
%>
<html>
<head>
<title>(airzen 2004/05/13 Version of Procedure)</title>
<meta http-equiv="Conten</p> 使用cdonts,可以发送、查看邮件,实现webmail的功能。结合wsh,可以实现对nt主机的管理,如nt用户管理、iis虚拟主机设置、exchange邮箱设置等等,就像管理本地机一样方便。 |
|