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

📄 howto_connect_datareport_to_ado.html

📁 How to ping ip address in VB
💻 HTML
字号:
<HTML>
<META http-equiv="PICS-Label" content='(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" by "RodStephens@vb-helper.com" for "http://www.vb-helper.com" on "1998.03.17T18:18-0800" r (n 0 s 0 v 0 l 0))'>
<HEAD>
<TITLE>VB Helper: HowTo: Connect a DataReport to an ADO Recordset</TITLE>
<META NAME="Author" CONTENT="Rod Stephens">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Keywords" CONTENT="DataReport, ADO, Recordset">
<META NAME="Keywords" CONTENT="DataReport, ADO, Recordset">
<META NAME="Description" CONTENT="VB Helper: HowTo: Connect a DataReport to an ADO Recordset">
<META NAME="Copyright" CONTENT="Copyright 1997-2003, Rocky Mountain Computer Consulting, Inc.">
<META NAME="Rating" CONTENT="General">
<META NAME="Robots" CONTENT="All">
</HEAD>

<BODY BGCOLOR="#E1F3FF" BACKGROUND="bg_blue.jpg">

  <!-- This table contains the banner, menu column, and content. -->
  <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
    <!-- ****** -->
    <!-- Banner -->
    <!-- ****** -->
    <TR><TD>
      <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="Left">
        <TR>
          <TD BACKGROUND="banner_mid.jpg"><IMG SRC="banner_l.jpg" WIDTH="410" HEIGHT="64"></TD>
          <TD BGCOLOR="#E1F3FF"><IMG SRC="banner_r.jpg" WIDTH="32" HEIGHT="64"></TD>
        </TR>
      </TABLE>
    </TD></TR>
    <TR><TD>&nbsp;</TD></TR>

    <!-- Menu column and content -->
    <TR><TD>
      <TABLE WIDTH="100%" BORDER="0" CELLSPACING="2" CELLPADDING="0">
        <!-- *********** -->
        <!-- Menu column -->
        <!-- *********** -->
        <TR>
          <TD ALIGN="Left" VALIGN="Top">
            <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
              <!-- Menu top -->
              <TR>
                <TD><IMG SRC="blue_ul.jpg" WIDTH="16" HEIGHT="16"></TD>
                <TD><IMG SRC="blue_um.jpg" WIDTH="93" HEIGHT="16"></TD>
                <TD><IMG SRC="blue_ur.jpg" WIDTH="16" HEIGHT="16"></TD>
              </TR>

              <!-- Menu entries -->
              <TR BGCOLOR="#7FCFFF">
                <TD BACKGROUND="blue_l.jpg" WIDTH="16">&nbsp;</TD>
                <TD><CENTER>
                  <A HREF="index.html"><B><FONT SIZE="+1">Home</FONT></B></A><BR>
                  <A HREF="search.html"><B>Search</B></A><BR>
                  &nbsp;<BR>
                  <A HREF="whats_new.html"><B>What's New</B></A><BR>
                  <A HREF="index_categories.html"><B>Index</B></A><BR>
                  <A HREF="books.html"><B>Books</B></A><BR>
                  <A HREF="links.html"><B>Links</B></A><BR>
                  <A HREF="http://www.topica.com/lists/VBHelperQA/read"><B>Q &amp; A</B></A><BR>
                  <A HREF="newsletter.html"><B>Newsletter</B></A><BR>
                  <A HREF="banners.html"><B>Banners</B></A><BR>
                  &nbsp;<BR>
                  <A HREF="mailto:feedback@vb-helper.com"><B>Feedback</B></A><BR>
                  <A HREF="tip_jar.html"><B>Tip Jar</B></A><BR>
                </CENTER></TD>
                <TD BACKGROUND="blue_r.jpg" WIDTH="16">&nbsp;</TD>
              </TR>

              <!-- Menu bottom -->
              <TR>
                <TD><IMG SRC="blue_ll.jpg" WIDTH="16" HEIGHT="16"></TD>
                <TD><IMG SRC="blue_lm.jpg" WIDTH="93" HEIGHT="16"></TD>
                <TD><IMG SRC="blue_lr.jpg" WIDTH="16" HEIGHT="16"></TD>
              </TR>

              <TR><TD HEIGHT="50" COLSPAN="3">&nbsp;</TR></TD>

              <!-- ***************** -->
              <!-- Amazon Recommends -->
              <!-- ***************** -->
              <TR><TD COLSPAN="3" ALIGN="Center">
<!-- -->
                <SCRIPT SRC="http://rcm.amazon.com/e/cm?t=vbhelper&l=rc1&p=2&o=1" TYPE="text/JavaScript"></SCRIPT>
<!-- -->
                <NOSCRIPT>
                  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="125">
                    <TR><TD>
                      <MAP NAME="boxmap">
                        <AREA SHAPE="RECT" COORDS="18, 263, 105, 274" HREF="http://rcm.amazon.com/e/cm/privacy-policy.html?o=1">
                        <AREA COORDS="0,0,10000,10000" HREF="http://www.amazon.com/exec/obidos/redirect-home/vbhelper">
                      </MAP>
                      <img src="http://rcm-images.amazon.com/images/G/01/associates/amzn_recommends/gnbox125x275.gif" width="125" height="275" border="0" usemap="#boxmap">
                    </TD></TR>
                  </TABLE>
                </NOSCRIPT>
              </TD></TR>
              <TR><TD HEIGHT="50" COLSPAN="3">&nbsp;</TR></TD>

              <!-- ******** -->
              <!-- Partners -->
              <!-- ******** -->
              <!-- NetFlix -->
              <TR><TD COLSPAN="3" ALIGN="Center">
<IMG SRC="http://service.bfast.com/bfast/serve?bfmid=27276611&siteid=40078832&bfpage=s_120x60style4" BORDER="0" WIDTH="1" HEIGHT="1" NOSAVE >
<A HREF="http://service.bfast.com/bfast/click?bfmid=27276611&siteid=40078832&bfpage=s_120x60style4" TARGET="_top"><IMG SRC="http://a408.g.akamai.net/f/408/1284/24h/image.netflix.com/NetFlix_Assets/affiliates/banners/S12060v4.gif" BORDER="0" WIDTH="120" HEIGHT="60" ALT=""></A>
              </TR></TD>
              <TR><TD HEIGHT="10" COLSPAN="3">&nbsp;</TR></TD>

              <!-- Wiley -->
              <TR><TD COLSPAN="3" ALIGN="Center" BACKGROUND="sandpaper.gif"><A HREF="http://service.bfast.com/bfast/click?bfmid=37920629&siteid=40078832&bfpage=computer_science" TARGET="_top"><IMG SRC="wiley_logo.gif" BORDER="0" ALIGN="Center" WIDTH="77" HEIGHT="105"></TD></TR>
              <TR><TD HEIGHT="10" COLSPAN="3">&nbsp;</TR></TD>

              <!-- Que -->
              <TR><TD COLSPAN="3" ALIGN="Center"><A HREF="http://www.quepublishing.com"><IMG SRC="que.gif" BORDER="0" ALIGN="Center" WIDTH="121" HEIGHT="36"></A></TD></TR>
              <TR><TD HEIGHT="10" COLSPAN="3">&nbsp;</TR></TD>

              <!-- Amazon -->
              <TR><TD COLSPAN="3" ALIGN="Center"><A HREF="amazon.html"><IMG SRC="amazon_logo.gif" BORDER="0" ALIGN="Center" WIDTH="68" HEIGHT="65"></A></TD></TR>
              <TR><TD HEIGHT="100" COLSPAN="3">&nbsp;</TR></TD>

              <!-- ********** -->
              <!-- More stuff -->
              <!-- ********** -->

              <!-- Old Menu top -->
              <TR>
                <TD><IMG SRC="magenta_ul.jpg" WIDTH="16" HEIGHT="16"></TD>
                <TD><IMG SRC="magenta_t.jpg" WIDTH="93" HEIGHT="16"></TD>
                <TD><IMG SRC="magenta_ur.jpg" WIDTH="16" HEIGHT="16"></TD>
              </TR>

              <!-- Menu entries -->
              <TR BGCOLOR="#E36BFF">
                <TD BACKGROUND="magenta_lside.jpg" WIDTH="16">&nbsp;</TD>
                <TD><CENTER>
                  <B><FONT SIZE="+1">Old Pages</FONT></B><BR>
                  &nbsp;<BR>
                  <A HREF="old_index.htm"><B>Old Index</B></A></BR>
                  <A HREF="sitemap.htm"><B>Site Map</B></A></BR>
                  <A HREF="whatsnew.htm"><B>What's New</B></A></BR>
                  &nbsp;<BR>
                  <A HREF="books.htm"><B>Books</B></A></BR>
                  <A HREF="howto.htm"><B>How To</B></A></BR>
                  <A HREF="tips.htm"><B>Tips &amp; Tricks</B></A></BR>
                  <A HREF="tutorial.htm"><B>Tutorials</B></A></BR>
                  <A HREF="stories.htm"><B>Stories</B></A></BR>
                  <A HREF="perform.htm"><B>Performance</B></A></BR>
                  <A HREF="essays.htm"><B>Essays</B></A></BR>
                  <A HREF="links.htm"><B>Links</B></A></BR>
                  <A HREF="q_and_a.htm"><B>Q &amp; A</B></A></BR>
                  <A HREF="newvb6.htm"><B>New in VB6</B></A></BR>
                  <A HREF="free.htm"><B>Free Stuff</B></A></BR>
                  <A HREF="pictures.htm"><B>Pictures</B></A></BR>
                </CENTER></TD>
                <TD BACKGROUND="magenta_rside.jpg" WIDTH="16">&nbsp;</TD>
              </TR>

              <!-- Old Menu bottom -->
              <TR>
                <TD><IMG SRC="magenta_ll.jpg" WIDTH="16" HEIGHT="16"></TD>
                <TD><IMG SRC="magenta_b.jpg" WIDTH="93" HEIGHT="16"></TD>
                <TD><IMG SRC="magenta_lr.jpg" WIDTH="16" HEIGHT="16"></TD>
              </TR>

              <!-- Other stuff in the menu column -->
              <TR><TD HEIGHT="100" COLSPAN="3">&nbsp;</TR></TD>
            </TABLE>
          </TD>

          <!-- A little space between the menus and content -->
          <TD WIDTH="5">&nbsp;</TD>

          <!-- ******* -->
          <!-- Content -->
          <!-- ******* -->
          <TD WIDTH="100%" ALIGN="Left" VALIGN="Top">
            <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
              <!-- How To Summary -->
              <TR><TD>
                <TABLE WIDTH="100%" BORDER="2" CELLSPACING="0" CELLPADDING="2">
                  <TR><TH ALIGN="Left">Title</TH><TD WIDTH="100%">Connect a DataReport to an ADO Recordset</TD></TR>
                  <TR><TH ALIGN="Left">Keywords</TH><TD>DataReport, ADO, Recordset</TD></TR>
                  <TR><TH ALIGN="Left">Categories</TH><TD>Database</TD></TR>
                </TABLE>
              </TD></TR>

              <!-- Text content -->
              <TR><TD>&nbsp;<BR></TD></TR>
              <TR><TD>
Open a Connection object to the database. Use the Connection object's Execute method to create a Recordset containing the desired records.
<P>
Then set the DataReport's DataSource property to the Recordset and display the DataReport.
              </TD></TR>

              <!-- Code content -->
              <TR><TD>&nbsp;<BR></TD></TR>
              <TR>
                <TD BACKGROUND="computer_paper.jpg">
                  <PRE><FONT NAME="Courier New" POINT-SIZE="10" SIZE="2">Private Sub Command1_Click()
Dim db_file As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

    <FONT COLOR="#008000">' Get the data.</FONT>
    db_file = App.Path
    If Right$(db_file, 1) &lt;&gt; "\" Then db_file = db_file &amp; _
        "\"
    db_file = db_file &amp; "books.mdb"

    <FONT COLOR="#008000">' Open a connection.</FONT>
    Set conn = New ADODB.Connection
    conn.ConnectionString = _
        "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
        "Data Source=" &amp; db_file &amp; ";" &amp; _
        "Persist Security Info=False"
    conn.Open

    <FONT COLOR="#008000">' Open the Recordset.</FONT>
    Set rs = conn.Execute("SELECT * FROM Books", , _
        adCmdText)

    <FONT COLOR="#008000">' Connect the Recordset to the DataReport.</FONT>
    Set rptBooks.DataSource = rs
    rptBooks.WindowState = vbMaximized
    rptBooks.Show vbModal

    rs.Close
    conn.Close
End Sub</FONT></PRE>
              </TD></TR>

              <!-- *************** -->
              <!-- Download button -->
              <!-- *************** -->

              <TR><TD><FONT SIZE="-2">&nbsp;</FONT></TD></TR>
              <TR><TD ALIGN="Center"><A HREF="HowTo/howto_connect_datareport_to_ado.zip"><IMG SRC="download.jpg" BORDER="0"></A></TD></TR>
              <TR><TD><FONT SIZE="-2">&nbsp;</FONT></TD></TR>

            </TABLE> <!-- End content table -->
          </TD>
        </TR> <!-- End row containing menu column and content -->
      </TABLE> <!-- End table containing menu column and content -->
    </TD></TR>

    <!-- ****** -->
    <!-- Footer -->
    <!-- ****** -->
    <TR><TD WIDTH="100%">
      <TABLE WIDTH="100%" BORDER="0" BGCOLOR="#87CEFA" CELLSPACING="0" CELLPADDING="0">
        <!-- Top row -->
        <TR>
          <TD BGCOLOR="#E1F3FF" ALIGN="Right" WIDTH="16"><IMG SRC="blue_ul.jpg" WIDTH="16" HEIGHT="16"></TD>
          <TD BACKGROUND="blue_um.jpg" COLSPAN="2" ALIGN="Center"><FONT SIZE="-2">
            Copyright &copy; 1997-2003 Rocky Mountain Computer Consulting, Inc. &nbsp; All rights reserved.
          </FONT></TD>
          <TD BGCOLOR="#E1F3FF"><IMG SRC="blue_ur.jpg" WIDTH="16" HEIGHT="16"></TD>
        </TR>

        <!-- Bottom row -->
        <TR>
          <TD BGCOLOR="#E1F3FF" ALIGN="Right" WIDTH="16"><IMG SRC="blue_ll.jpg" WIDTH="16" HEIGHT="16"></TD>
          <TD BACKGROUND="blue_lm.jpg"><FONT SIZE="-2">
            &nbsp;<SCRIPT LANGUAGE=JavaScript>document.write(document.URL)</SCRIPT></FONT></TD>
          <TD BACKGROUND="blue_lm.jpg" ALIGN="Right"><FONT SIZE="-2">
            Updated <SCRIPT LANGUAGE=JavaScript>document.write(document.lastModified)</SCRIPT> &nbsp;
          </FONT></TD>
          <TD BGCOLOR="#E1F3FF"><IMG SRC="blue_lr.jpg" WIDTH="16" HEIGHT="16"></TD>
        </TR>
      </TABLE>
    </TD></TR>
  </TABLE> <!-- End table containing banner, menu column + content, and footer -->

</BODY>
</HTML>

⌨️ 快捷键说明

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