Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i display records of an Access DB using the VBScript

Status
Not open for further replies.

almi

Programmer
Jun 19, 2001
16
0
0
YU
I have a price list in an access db. I want to display data in my web presentation using vbscript. How do i do that?
Please help me
 
This question have been answered many times already, and I'm sure you can find a better explanation elsewhere on the internet by doing a search.

This is, however, the general way of it (you need to change the table name and database name, of course, and the name of the fields in your database) :
Code:
<%
Dim db, rs, SQL_QUERY

Set db = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

SQL_QUERY = &quot;select * from table&quot;

db.Open &quot;DBQ=&quot; & Server.MapPath(&quot;database.mdb&quot;) & &quot;;Driver={Microsoft Access Driver (*.mdb)};&quot;
Set rs = db.Execute( SQL_QUERY )
%>

<table><%
   while not rs.EOF%>
      <tr>
         <td> <%=rs(&quot;field_1&quot;)%> </td>
         <td> <%=rs(&quot;field_2&quot;)%> </td>
         <td> <%=rs(&quot;field_3&quot;)%> </td>
         <td> <%=rs(&quot;field_4&quot;)%> </td>
         ...etc...
      </tr><%
      rs.MoveNext
   wend

   rs.Close
   db.Close%>
</table>

Hope this is helpful,
Palooka
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top