Simple Example Query using a fetch loop

<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DataFlex Test32" sql="select name,country,phone from dealers" Set RS = Conn.Execute(sql) %> Here are the results from the query:
<%=sql%>

<% Do While not RS.eof%> <% RS.MoveNext Loop RS.close Conn.close %>
<% = RS("name") %><% = RS("country") %><% = RS("phone") %>

The web page you see here was created with the results of an SQL query. The data was collected from a DataFlex data file by the Flex/ODBC 32 bit driver, then the merge was done using Microsoft Active Server Pages scripting with VBScript code imbedded in the source document. The results were returned to this web browser by the Microsoft Internet Information Server.

This query can be run using the standard Flex/ODBC product available now, running on NT Server 4.0 with our included sample databases.

Here is the source code to show how this query was created.

df3.asp:

  <HTML><HEAD>
  <TITLE>Flex/ODBC Live Data Demo</TITLE>
  </HEAD><BODY>
  <body background=dingbats/801.gif>
  <H2>Simple Example Query using a fetch loop</H2>
  <%
  Set Conn = Server.CreateObject("ADODB.Connection")
  Conn.Open "DataFlex Test32"
  sql="select name,country,phone from dealers"
  Set RS = Conn.Execute(sql)
  %>
  Here are the results from the query:<BR><I><B> <%=sql%></I></B><P>
  <TABLE BORDER>
  <%  Do While not RS.eof%>
        <TR>
        <TD><%= RS("name") %></TD><TD><%= RS("country") %></TD><TD><%= RS("phone") %></TD>
        </TR>
        <%
        RS.MoveNext
  Loop
  RS.close
  Conn.close
  %>
  </TABLE>
  </BODY></HTML>

----------

Home Search Feedback