⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demomssql.asp

📁 asp分类支持多级
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Cls_vbsPage.asp"-->
<%
'-----------------------------------------------------------------------------------------------
On Error Resume Next
DIM startime,endtime
'统计执行时间
startime=timer()
'连接数据库
DIM Db,Conn,Rs
strSQLServerName = "192.168.1.101"      '服务器名称或地址
strSQLDBUserName = "sa"           '数据库帐号
strSQLDBPassword = "123456"     '数据库密码
strSQLDBName = "zhikoinfo"    '数据库名称
Set Conn = Server.CreateObject("ADODB.Connection")
Db = "Provider=SQLOLEDB.1;Persist Security Info=False;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
Conn.open Db
'-----------------------------------------------------------------------------------------------
%>
<html>
<head>
<title>叶子ASP分页类-mssql调用示范</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
table {  font-size: 12px}
a {  font-size: 12px; color: #000000; text-decoration: none}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="760" border="0" cellspacing="2" cellpadding="2" align="center" height="30">
  <tr> 
    <td>&nbsp;</td>
  </tr>
</table>
<table width="760" border="1" cellspacing="0" cellpadding="4" align="center" bordercolordark="#FFFFFF" bordercolorlight="#CCCCCC">
  <tr align="center"> 
    <td width="20">ID</td>
    <td>标题</td>
    <td>内容(显示前20个字)</td>
    <td>时间</td>
  </tr>
  <%
Dim ors
Set ors=new Cls_vbsPage	'创建对象
Set ors.Conn=conn		'得到数据库连接对象
With ors
	.PageSize=10		'每页记录条数
	.PageName="Pages"	'cookies名称
	.DbType="MSSQL"
	'数据库类型,AC为access,MSSQL为sqlserver2000存储过程版,MYSQL为mysql,PGSQL为PostGreSql
	.RecType=0
	'记录总数(>0为另外取值再赋予或者固定值,0执行count设置存cookies,-1执行count不设置cookies)
	.JsUrl=""			'Cls_jsPage.js的路径
	.Pkey="QingBao_ID_int"			'主键
	.Field="QingBao_ID_int,QingBao_Name_nchr,QingBao_CashCard_nchr,QingBao_PinPai_nchr"
	.Table="zhikoinfo_qingbao"
	.Condition=""		'条件,不需要where
	.OrderBy=""	'排序,不需要order by,需要asc或者desc
End With

'iRecCount=ors.RecordCount()'记录总数
Rs=ors.ResultSet()		'返回ResultSet
If IsNull(Rs) Then%>
<tr bgcolor=""> 
    <td >暂无记录</td>    
  </tr>
<%
Else     
    For i=0 To Ubound(Rs,2)%>
  <tr bgcolor="#FFFFFF"> 
    <td><%=Rs(0,i)%></td>
    <td><%=Rs(1,i)%></td>
    <td><%=Rs(2,i)%></td>
    <td><%=Rs(3,i)%></td>
  </tr><%
    Next	
End If

%>
</table>
<table width="760" border="0" cellspacing="2" cellpadding="2" align="center">
  <tr> 
    <td>
<%ors.ShowPage()%>
</td>
  </tr>  
</table> 
<table width="760" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr> 
    <td align="center"> 
      <%endtime=timer()%>
      本页面执行时间:<%=FormatNumber((endtime-startime)*1000,3)%>毫秒</td>
  </tr>
</table>
</body>
</html>
<%
iRs=NULL
ors=NULL
Set ors=NoThing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -