<marquee width=358>欢迎来到月影社区,希望这里可以成为您美丽的梦幻花园,如果你觉得这里好请分享给您的朋友!- wf66.com</marquee> 将月影社区设置为您的首页将月影社区地址加入到您的收藏栏
月影社区时尚音乐音乐查询IP手机许愿之瓶最新更新文件加密访客留言爱音乐
欢迎您,首页 >> 信息中心 >> 当Recordcount返回-1时怎样计算记录数目

请输入您关键字:


当Recordcount返回-1时怎样计算记录数目

推荐查看本文HTML版本


<%
' BEGIN CONSTANT DEFINITION

' The following command includes the ADODB VBScript
constants file.
' If you can't find your copy you can download a copy from:
' http://www.asp101.com/samples/download/adovbs.inc
' It may not be the most recent copy so use it at your own
risk.

%>
<!-- #INCLUDE FILE="./download/adovbs.inc" -->
<%

' DB Configuration variables
' After this, strictly used as if it were a Const.
Dim DB_CONNSTRING
DB_CONNSTRING = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=" & Server.Mappath("./db_scratch.mdb") & ";"

' Now we override the above setting so the sample uses our
SQL server.
' Comment out the following line to use the sample Access
DB.
DB_CONNSTRING = Application("SQLConnString") & _
"UID=" & Application("SQLUsername") & ";" & _
"PWD=" & Application("SQLPassword") & ";"

' END CONSTANT DEFINITION
%>

<%
Dim rsCount ' The recordset object

' Create an instance of an ADO Recordset
Set rsCount = Server.CreateObject("ADODB.Recordset")

' Open RS
' I'm actually doing this directly (without a connection object) to
keep
' the code short and to the point. I'm opening the RS with a static
' cursor, read only, and telling it that "scratch" is a table name and
' not a SQL command. If I don't specify how to open the rs, I'd get
the
' default cursor type which doesn't support .RecordCount!
rsCount.Open "scratch", DB_CONNSTRING, adOpenStatic, adLockReadOnly,
adCmdTable

' Show RecordCount
' I dress it up and pop it into the middle of a sentence, but you can
' do whatever you want with it.
Response.Write "This table currently has <B><FONT COLOR=""#FF0000"">"
Response.Write rsCount.RecordCount ' This is the line that does it!
Response.Write "</FONT></B> records in it!<BR>" & vbCrLf


'=====================================================================
=
' BEGIN TABLE DISPLAY
' Now I'm going to display the table if they requested it just so you
' have something to look at! This really doesn't pertain to the topic
' of this sample so I'm going to keep the code short but feel free to
' look it over and if you do please notice the pretty HTML it outputs!
' Ugly HTML output is a pet peeve of mine! ;)
If LCase(Request.QueryString("showtable")) = "true" Then
Dim Field ' Field Looper for display
Dim bColor ' Use for showing alternating colors
bColor = False

' Spacers and intro
Response.Write "<BR>" & vbCrLf & "They are:<BR>" & vbCrLf
& "<BR>" & vbCrLf

' Start the table
Response.Write "<TABLE BORDER=""1"">" & vbCrLf

' Write Titles
Response.Write vbTab & "<TR>" & vbCrLf
For Each Field in rsCount.Fields [月影读书频道 http://wf66.com/]
Response.Write vbTab & vbTab & "<TD
BGCOLOR=""#CCCCCC""><B>" & Field.Name & "</B></TD>" & vbCrLf
Next 'Field
Response.Write vbTab & "</TR>" & vbCrLf

' Loop through records outputting data
Do While Not rsCount.EOF
Response.Write vbTab & "<TR>" & vbCrLf
For Each Field in rsCount.Fields
Response.Write vbTab & vbTab & "<TD
BGCOLOR="""

' Decide what color to output
If bColor Then
Response.Write "#CCCCFF" '
Light blueish
Else
Response.Write "#FFFFFF" ' White
End If

Response.Write """>" & Field.Value
& "</TD>" & vbCrLf
Next 'Field
Response.Write vbTab & "</TR>" & vbCrLf

' Toggle our colors
bColor = Not bColor
rsCount.MoveNext
Loop

' End the table
Response.Write "</TABLE>" & vbCrLf
Response.Write "<BR><A HREF=""db_count.asp"">Hide the
table</A>" & vbCrLf
Else
Response.Write "<BR><A HREF=""db_count.asp?
showtable=true"">Show the table</A>" & vbCrLf
End If
' END TABLE DISPLAY - Now back to our regularly scheduled code!
'=====================================================================
=

' Close and dispose of recordset object
rsCount.Close
Set rsCount = Nothing
%>


当Recordcount返回-1时怎样计算记录数目 2006-8-28
转到本主题第:[ 1 ]
相关评论

暂无评论

总计0页 [ ]上一页 下一页
发表评论(揪错)
呢称: * 您尚未登陆,请登录
来自: *
内容:
 

(为防止非法信息,您的言论提交后需要审核才能正常显示)

文学
精品文萃 情感天地 言情小说
网络小说 玄幻小说 悬疑恐怖
武侠小说 古典品谈 外国名著
儿童文学 会员原创 学习园地
杂谈其它
娱乐
爆笑网文 星座占卜 影音动漫
娱乐新闻 影视剧情
诗词
青竹诗歌 个人诗集 宋词雅赏
全唐诗录
新闻
国际新闻 国内新闻 科技新闻
体育新闻
图片
图文专区 艺术长廊 桌面壁纸
精品素材 像素图片
漫画
单幅漫画 爆笑四格 连环漫画
电脑
电脑入门 图形图像 编程开发
游戏
我爱Q宠 最新攻略 最新秘籍
游戏新闻 技巧心得
经济
帕格节电 财经资讯 股市证券
生活
百科知识 外语学院 潮流时尚
健康医疗 宠物花卉 汽车地带
行走天下
美食
面食甜点 家常菜品 药膳食疗
美食天下 烹饪技巧 松辽风味
燕京风味 巴蜀风味 滇黔风味
赣江风味 徽皖风味 闽台风味
齐鲁风味 中州风味 岭南风味
荆楚风味 三晋风味 淞沪风味
苏扬风味 潇湘风味 钱塘风味
民族风味 素斋仿荤
营销
管理杂谈 谈经论道 培训激励
经营战略 职场生涯 公关交际
关于我们版权声明本站导航友情连结作品演示 TOP↑
本论坛言论纯属发表者个人意见,与£月影社区£立场无关。 皖ICP备16024038号-1
禁止发布任何色情/政治/反动相关信息让我们共同来营造一个属于我们的梦幻家园
Copyright ©2001-2006 MoonShadow. All rights reserved.  Version 4.0  Licence 2006.4.2
建站天数:7211天 本站基于ASP+JS构建,完全自主开发,版权归属月影社区 管理员QQ:23165062 Time:78ms