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

📄 使用nextrecordset通过一个connection输出多个select查询.htm

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 HTM
📖 第 1 页 / 共 2 页
字号:
    <TD width=753></TD>
    <TD bgColor=#297dff width=1> </TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR vAlign=top>
    <TD bgColor=#297dff width=1> </TD>
    <TD width=753>
      <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
        <TBODY>
        <TR>
          <TD bgColor=#297dff colSpan=2 height=20><FONT color=#ceffff>&nbsp;→ 
            <A href="http://www.aspsky.net/article/index.asp?classid=2"><FONT 
            color=#ceffff>ASP技术</FONT></A> &gt;&gt; <A 
            href="http://www.aspsky.net/article/index.asp?classid=2&amp;Nclassid=3"><FONT 
            color=#ceffff>ASP技巧</FONT></A> &gt;&gt; 
            《使用NextRecordset通过一个Connection输出多个select查询》</FONT></TD></TR>
        <TR>
          <TD bgColor=#586011 colSpan=2 height=1><SPACER type="block" 
            width="1"></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR>
        <TR>
          <TD align=middle class=p4 
            colSpan=2><B>使用NextRecordset通过一个Connection输出多个select查询</B></FONT><BR>2002-6-13&nbsp;&nbsp;动网先锋 
          </TD></TR>
        <TR>
          <TD class=p4 colSpan=2>
            <BLOCKQUOTE><BR>&lt;%<BR>dim conn<BR>dim strconn<BR>dim rs<BR>dim 
              strsql <BR>dim strsql2<BR>dim strsql3<BR>dim strsql4<BR>dim 
              strsql5<BR>dim strsql6<BR>dim strsql7<BR>dim strsql8
              <P></P>
              <P>'strconn = Driver={SQL 
              Server};Description=example;SERVER=222.222.1.2;UID=webexample;PWD=;DATABASE=webexample"</P>
              <P><BR>'Format Declare &amp; EXEC statements that will be 
              passed<BR>'to the database with the output parameters<BR>strsql = 
              "DECLARE " &amp; CHR(10) &amp; "@Id_Req " &amp; "INT" &amp; 
              CHR(10)<BR>strsql2 ="exec " &amp; "sp_EmpInfo" &amp; " '" &amp; 
              request("txtFirstName") &amp; "'," &amp; "'" &amp; 
              request("txtLastName") &amp; "', " &amp; "'" &amp; 
              request("txtaddress") &amp; "', " &amp; "'" &amp; 
              request("txtcity") &amp; "', "&amp; "@Id_Req " &amp; "OUTPUT" 
              &amp; chr(10)</P>
              <P>'Formats one or more sql statements that will be passed to the 
              <BR>'database In this examples I use six different 
              ways.<BR>strsql3 ="SELECT * FROM AllData WHERE RecordId = @Id_Req" 
              &amp; Chr(10)<BR>strsql4 ="SELECT AllData.fname, AllData.lname 
              FROM Alldata WHERE RecordId = @Id_Req" &amp; Chr(10)<BR>strsql5 
              ="SELECT AllData.fname FROM AllData WHERE RecordId = @Id_Req" 
              &amp; Chr(10)<BR>strsql6 ="SELECT AllData.lname FROM AllData WHERE 
              RecordId = @Id_Req" &amp; Chr(10)<BR>strsql7 ="SELECT 
              AllData.Address FROM AllData WHERE RecordId = @Id_Req" &amp; 
              Chr(10)<BR>strsql8 ="SELECT AllData.city FROM AllData WHERE 
              RecordId = @Id_Req" &amp; Chr(10)</P>
              <P>'Puts together all of the local variables into one variable 
              <BR>'That will be used by the recordset object<BR>strsql = strsql 
              &amp; strsql2 &amp; strsql3 &amp; strsql4 &amp; strsql5 &amp; 
              strsql6 &amp; strsql7 &amp; strsql8</P>
              <P>'This is optional this writes out the strsql local 
              variable<BR>'that will be passed to the database 
              <BR>response.write "&lt;b&gt;" &amp; "Sql Statement that is passed 
              to the database" &amp; "&lt;/b&gt;" &amp; 
              "&lt;br&gt;"<BR>response.write strsql &amp; "&lt;br&gt;" &amp; 
              "&lt;br&gt;"</P>
              <P>'sets a connection &amp; recordset objects and executes the 
              strsql local variable<BR>set conn = 
              server.createobject("adodb.connection")<BR>conn.open 
              strconn<BR>set rs = 
              server.createobject("adodb.recordset")<BR>rs.open strsql, conn 
</P>
              <P>'Parses out the individual recordsets and places them<BR>'into 
              individual table rows<BR>intcount = 1<BR>Do Until rs Is 
              Nothing<BR>response.write "&lt;table border='1' width='25%'&gt;" 
              </P>
              <P>response.write "&lt;b&gt; Contents of recordset #" &amp; 
              intCount &amp; "&lt;/b&gt;&lt;br&gt;" <BR>'Parses out the 
              individual recordsets and places them into table rows<BR>Do While 
              Not rs.EOF<BR>response.write "&lt;TR&gt;" <BR>For Each oField In 
              RS.Fields <BR>response.write "&lt;TH&gt;" &amp; oField.Name &amp; 
              "&lt;/TH&gt;"<BR>Next <BR>Response.write "&lt;/TR&gt;" &amp; 
              "&lt;TR&gt;"<BR>For Each oField In RS.Fields <BR>response.write 
              "&lt;TD ALIGN=center&gt;"<BR>If IsNull(oField) Then 
              <BR>Response.Write " "<BR>Else<BR>Response.Write 
              oField.Value<BR>End If <BR>response.write "&lt;/TD&gt;" <BR>Next 
              <BR>rs.MoveNext<BR>Loop<BR>'Uses the NEXTRECORDSET Method<BR>Set 
              rs = rs.NextRecordset<BR>intCount = intCount + 1<BR>response.write 
              "&lt;/table&gt;"<BR>Loop<BR>%&gt; <BR><BR></P></BLOCKQUOTE></TD></TR>
        <TR>
          <TD class=p4 vAlign=top width="50%">
            <BLOCKQUOTE>原作者:大洲<BR>来 源:开发者俱乐部<BR>共有2734位读者阅读过此文<BR>【<A 
              href="http://bbs.aspsky.net/list.asp?boardid=1">发表评论</A>】 
            </BLOCKQUOTE></TD>
          <TD class=p4 vAlign=top width="50%">
            <P>
            <LI><FONT color=#0772b1>上篇文章</FONT>:<A 
            href="http://www.aspsky.net/article/list.asp?id=2745">超长字符的智能分页-支持HTML</A> 
            <BR>
            <LI><FONT color=#0772b1>下篇文章</FONT>:<A 
            href="http://www.aspsky.net/article/list.asp?id=2747">利用FSO取得BMP,JPG,PNG,GIF文件信息</A> 
            </LI></TD></TR>
        <TR>
          <TD bgColor=#297dff class=p4 height=20 width="50%"><FONT 
            color=#ceffff>&nbsp;→ 本周热门</FONT></TD>
          <TD bgColor=#297dff class=p4 width="50%"><FONT color=#ceffff>&nbsp;→ 
            相关文章</FONT></TD></TR>
        <TR>
          <TD bgColor=#586011 colSpan=2 height=1><SPACER type="block" 
            width="1"></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR>
        <TR>
          <TD class=p4 vAlign=top width="50%">
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1510" 
            target=_top title="SQL Server 7.0 入门(一)">SQL Server 7.0 
            入门(...</A>[<FONT color=red>7239</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1540" 
            target=_top title=PHP4实际应用经验篇(1)>PHP4实际应用经验篇(1)</A>[<FONT 
            color=red>7135</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1536" 
            target=_top 
            title=无组件文件上传代码实例(支持多文件上传及文件和input域混合上传)>无组件文件上传代码实例(支持多文件上...</A>[<FONT 
            color=red>6029</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2557" 
            target=_top title=树型结构在ASP中的简单解决>树型结构在ASP中的简单解决</A>[<FONT 
            color=red>5757</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1545" 
            target=_top title=PHP4实际应用经验篇(6)>PHP4实际应用经验篇(6)</A>[<FONT 
            color=red>5599</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2563" 
            target=_top title=一个老个写的无组件上传>一个老个写的无组件上传</A>[<FONT 
            color=red>5013</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1542" 
            target=_top title=PHP4实际应用经验篇(3)>PHP4实际应用经验篇(3)</A>[<FONT 
            color=red>4731</FONT>]<BR></LI></TD>
          <TD class=p4 vAlign=top width="50%">
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2746">使用NextRecordset通过一个Connection输出多个select查询</A><BR>
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2708">组合查询之核心:拼接字符串</A><BR>
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2561">怎么样写一段高效,安全的sql查询代码</A><BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2387">用 WSH 
            想ASP 一样 查询数据库</A><BR>
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2386">最简洁的多重查询的解决方案</A><BR>
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2196">用正则表达式突出显示字符串中查询到的单词的函数</A><BR>
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=1952">怎么秋实现输入拼音的按照汉字查询?或输入拼音的按照汉字查询?</A><BR></LI></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR></TBODY></TABLE>
    <TD bgColor=#297dff width=1> </TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD bgColor=#297dff height=1><SPACER type="block" 
width="1"></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD align=middle height=30></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD align=middle class=p2 width="100%">
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
        <TBODY>
        <TR>
          <TD align=middle class=p2 width="100%">
            <P align=center><A 
            href="http://www.aspsky.net/produce/index.asp">客户服务</A> -- <A 
            href="http://www.aspsky.net/aspads.asp">广告合作</A> -- <A 
            href="http://www.aspsky.net/about.asp">关于本站</A> -- <A 
            href="http://www.aspsky.net/tell.asp">联系方法</A><BR><BR>动网先锋版权所有 <FONT 
            face=Verdana, size=1 Arial, Helvetica, sans-serif>Copyright &copy; 
            2000-2001 <B>AspSky<FONT color=#cc0000>.Net</FONT></B>, All Rights 
            Reserved .</FONT> 
</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER></CENTER></BODY></HTML>

⌨️ 快捷键说明

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