首 页 | 精品电影 | 音乐天堂 | 在线游戏 | Flash MTV | 三湘书屋 | 幽默笑话 | 三湘图库 | 美女写真 | IT知识库 | QQ贴图 | 加入书签

网页制作网络编程图形图象操作系统冲浪宝典软件教学网络安全认证考试通信技术电子商务业内动态书籍教程原码

最近更新 文章分类 多媒体类 精品软件

本站搜索:
您的位置:三湘时空 -> IT知识库 -> 文章分类 -> ASP技巧 -> 使用NextRecordset通过一个Connection输出多个select查询  
使用NextRecordset通过一个Connection输出多个select查询


文章类别:ASP技巧 来源: 作者: 发表日期:2005-10-4 字体:[ ]

小游戏 | 在线影院 | 幽默笑话 | 源码下载 | Flash MTV | 音乐试听 | 书屋 | 美女写真

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

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


'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)

'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)

'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 & strsql8

'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>"

'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

'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%'>"    

    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
%>
上一篇:利用FSO取得BMP,JPG,PNG,GIF文件信息(大小,宽、高等) 下一篇:一个分页存储过程
本栏目热门文章
·WEB打印设置解决方案二(利用ScriptX.cab控件改变IE打印 2005-10-4
·WEB打印设置解决方案三(FileSystem组件实现WEB打印) 2005-10-4
·使用VBScript操作Html复选框(CheckBox)控件 2005-10-4
·automation服务器不能创建对象 2006-1-6
·HTTP_REFERER的工作方式 2005-10-4
·用ASP和Microsoft.XMLDOM分析远程XML文件 2005-10-4
·XMLHTTP Get HTML页面时的中文乱码之完全客户端Scri 2005-10-4
·使用ActiveX控件开发网页常见的问题 2005-10-4
·关于 aspsmartupload 注册问题 2005-10-4
·判断checkbox是否至少有选择一项 2005-10-8
新近更新文章
·ASP网站漏洞解析及黑客入侵防范方法 2006-6-22
·将asp页面转换成htm页面 2006-6-20
·使用JMail组件代替Sql Mail发送Email 遇到的问题 2006-6-15
·Ajax & XMLHttpRequset 2006-6-15
·如何让图片自动缩放以适合界面大小 2006-6-15
·用正则解析图片地址,并利用XMLHTTP组件将其保存 2006-6-15
·用ASP+CSS实现随机背景 2006-6-4
·关于Cookie跨域操作遇到的问题及解决方法 2006-6-4
·编写数据库操作类,使ASP.NET中的数据库操作变得简单 2006-5-22
·一个简单的用存储过程分页 2006-5-18
首 页 | 软件发布 | 广告联系 | 下载帮助 | 意见反馈 | 网站地图
  CopyRight? 2002-2004 WWW.SXSKY.NET? All Rights Reserved
三湘时空 站长QQ:82675303 Email: