
August 28th, 2001, 06:20 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : </b></i><br /><br />------------<br />HeatherP 8/28/01<br />This is the only way I know how, hope this helps<br />Create a seperate file, Name it DatabaseConnect.asp then cut and paste this code<br />(NOTE!!!DatabaseConnect.asp must be in the same folder as the asp file!><br /><%<br />'This listing is a DSN-Less Connection going to access database <br />Dim objConn<br />Set objConn = Server.CreateObject("ADODB.Connection")<br />objConn.ConnectionString="Driver={Microsoft Access Driver (*.mdb)};" & "DBQ=C:My DocumentsYourFolderYourDatabase.mdb"<br />objConn.Open<br />%><br /><br />Then in the begining of your asp file use this code<br /><br /><%@ Language=VBScript %><br /><% Option Explicit %><br /><!--#include File="DatabaseConnect.asp"--><br /><!--#include virtual="/adovbs.inc"--><br /><HTML><br /><BODY><br /><%<br />Dim strSQL<br />strSQL = "SELECT Column1, Column2, Column3, FROM tblColumn ORDER BY Price DESC"<br /><br />'Create a recordset object instance, and execute the SQL Statement<br />Dim objRS<br />Set objRS = Server.CreateObject("ADODB.Recordset")<br />objRS.Open strSQL, objConn<br /><br />'We are displaying the Columns by price<br />%><Align="CENTER"><br /><B><font size="10">A Listing of Columns:</Font></B><br /><div align="center"><br /> <center><br /><TABLE border=1 cellpadding=3 cellspacing="3"><br /><TR><TD align="center"><B>Column 1</TD><br /><TD align="center"><B>Column 2</TD><br /><TD align="center"><B>Column 3</TD></TR><br /><%<br />Do While Not objRS.EOF<br />Response.Write "<TR><TD><FONT FACE=Arial>" & objRS("Column1") & "</TD>"<br />Response.Write "<TD><FONT FACE=Arial>" & objRS("Column2") & "</TD>"<br />Response.Write "<TD><FONT FACE=Arial>" & objRS("Column3") & "</TD></TR><BR>"<br />'Move on to the next line(row)<br />objRS.MoveNext<br />Loop<br /><br />'Clean up our ADO objects<br />objRS.Close<br />Set objRS = Nothing<br /><br />objConn.Close<br />Set objConn = Nothing<br />%><br /></TABLE><br /></BODY><br /></HTML><br /><br />Granted you will need to fill in the blanks but I hope this helps!<br /><br />
|