进入旧版 | 服务项目 | 成功案例 | 联系方式 | 过客留言 | 友情链接
   
设为首页
加入收藏
联系我们
网站首页 | 新闻资讯 | 操作系统 | 办公软件 | 网络软件 | 工具软件 | 媒体动画 | 网页制作 | 网站开发 | 程序开发 | 平面设计
Photoshop视频教程 | Word入门 | Flash入门 | JScript | VBScript | ASP | PHP | ADO | 网页特效 | 3DS MAX6.0命令 | 系统进程
您当前的位置:GOODSGY电脑学习网 -> 网站开发 -> ASP -> 文章内容  
使用NextRecordset通过一个Connection输出多个select查询

<%
dim conn
dim strconn
dim rs
dim strsql
dim strsql2
dim strsql3
dim strsql4
dim strsql5
dim strsql6
dim strsql7
dim strsql8

www.goodsgy.com

'strconn = Driver={SQL Server};Description=example;SERVER=222.222.1.2;UID=webexample;PWD=;DATABASE=webexample"www.goodsgy.com


'Format Declare & EXEC statements that will be passed
'to the database with the output parameters
strsql = "DECLARE " & CHR(10) & "@Id_Req " & "INT" & CHR(10)
strsql2 ="exec " & "sp_EmpInfo" & " '" & request("txtFirstName") & "'," & "'" & request("txtLastName") & "', " & "'" & request("txtaddress") & "', " & "'" & request("txtcity") & "', "& "@Id_Req " & "OUTPUT" & chr(10)www.goodsgy.com

'Formats one or more sql statements that will be passed to the
'database In this examples I use six different ways.
strsql3 ="SELECT * FROM AllData WHERE RecordId = @Id_Req" & Chr(10)
strsql4 ="SELECT AllData.fname, AllData.lname FROM Alldata WHERE RecordId = @Id_Req" & Chr(10)
strsql5 ="SELECT AllData.fname FROM AllData WHERE RecordId = @Id_Req" & Chr(10)
strsql6 ="SELECT AllData.lname FROM AllData WHERE RecordId = @Id_Req" & Chr(10)
strsql7 ="SELECT AllData.Address FROM AllData WHERE RecordId = @Id_Req" & Chr(10)
strsql8 ="SELECT AllData.city FROM AllData WHERE RecordId = @Id_Req" & Chr(10)www.goodsgy.com

'Puts together all of the local variables into one variable
'That will be used by the recordset object
strsql = strsql & strsql2 & strsql3 & strsql4 & strsql5 & strsql6 & strsql7 & strsql8www.goodsgy.com

'This is optional this writes out the strsql local variable
'that will be passed to the database
response.write "<b>" & "Sql Statement that is passed to the database" & "</b>" & "<br>"
response.write strsql & "<br>" & "<br>"www.goodsgy.com

'sets a connection & recordset objects and executes the strsql local variable
set conn = server.createobject("adodb.connection")
conn.open strconn
set rs = server.createobject("adodb.recordset")
rs.open strsql, conn www.goodsgy.com

'Parses out the individual recordsets and places them
'into individual table rows
intcount = 1
Do Until rs Is Nothing
response.write "<table border='1' width='25%'>" www.goodsgy.com

response.write "<b> Contents of recordset #" & intCount & "</b><br>"
'Parses out the individual recordsets and places them into table rows
Do While Not rs.EOF
response.write "<TR>"
For Each oField In RS.Fields
response.write "<TH>" & oField.Name & "</TH>"
Next
Response.write "</TR>" & "<TR>"
For Each oField In RS.Fields
response.write "<TD ALIGN=center>"
If IsNull(oField) Then
Response.Write " "
Else
Response.Write oField.Value
End If
response.write "</TD>"
Next
rs.MoveNext
Loop
'Uses the NEXTRECORDSET Method
Set rs = rs.NextRecordset
intCount = intCount + 1
response.write "</table>"
Loop
%>www.goodsgy.com

在百度中搜索:使用NextRecordset通过一个Connection输出多个select查询
在Google中搜索:使用NextRecordset通过一个Connection输出多个select查询
在Yahoo中搜索:使用NextRecordset通过一个Connection输出多个select查询

收藏到网摘:新浪VIVI 365key 我摘 POCO网摘 博采中心 YouNote 和讯网摘 天天收藏
[] [返回上一页] [打 印] [收 藏]

 相关文章    最新文章
· [组图] 简单使用PS历史画笔快速美化照片
· [图文] WPS演示中应用荧光笔的使用技巧
· WinServer 2008下调教IE使用有巧招
· 消除使用QQ后带来的安全隐患
· [图文] 网页标准制作:使用ul多行多列布局..
· 高效使用Linux的七个习惯
· 普通用户Excel使用VBA的几个误区
· [图文] Excel使用技巧:分列功能的妙用
· [图文] Excel技巧:使用中国式排名效果
· 选择使用新版Excel 2007的10条理由
 
· 初学ASP编程易犯的一个错误要注意
· ASP实现SQL语句日期格式的加减运算
· ASP程序中输出Excel文件实例一则
· ASP实现IE地址栏参数的判断
· ASP技巧:判断远程图片是否存在
· ASP去掉字符串头尾连续回车和空格的Funct..
· 深入认识学习ASP应用Cookies的技巧
· ASP实现邮件发送普通附件和嵌入附件
· 在ASP.NET中把图片保存到SQL SERVER数据库..
· 巧用枚举CommandBehavior关闭SqlDataRead..

∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论…]
站内搜索

精彩图文
  网站导航  
操作系统 办公软件 网络软件
Vista Windows2003 WindowsXP Windows2000/NT Windows9X/ME Linux 其他 Word Excel Powerpoint Outlook 金山系列 其他 网页浏览 上传下载 联络聊天 邮件工具 服务器软件 网络辅助
工具软件 媒体动画 网页制作
系统工具 媒体工具 压缩工具 图文处理 文件管理 其他 3DMAX Authorware Director Maya 视频处理 其他 Flash Dreamweaver FireWorks FrontPage LiveMotion Golive HTML/CSS 其它
网站开发 平面设计 程序设计
ASP JSP PHP CGI JavaScript VBScript XML/SOAP Web服务器 Photoshop PhotoImpact CorelDraw Illustrator Freehand 设计欣赏 其他 VB VC .NET C/C++ DELPHI JAVA

冀ICP备05019428号
Copyright © 2004-2008 电脑学习网 Inc.All rights reserved.
TEL:13832340607
QQ:39873155
E_Mail:goodsgy(#)hotmail.com   (把(#)替换成@)
MSN:goodsgy(#)hotmail.com   (把(#)替换成@)