I'm teaching myself ASP and setting up a database with Access that I can hit
through a web front. I'm using Windows2000 Professional with IIS (PWS). I
need a clear example of the VB Script code I'll need to open a connection to
the database (address.mdb)
Any help will be greatly appreciated!
Thanks,
<hmtl><body>
<%
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "DSN=pwd"
Set DataCmd = Server.CreateObject("ADODB.Command")
DataCmd.CommandText = "SELECT field1 FROM table"
Set DataCmd.ActiveConnection = DataConn
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open DataCmd,,,,adCmdText
do while not rst.EOF
response.write rst("field1")
rst.movenext
loop
%>
</body></html>
I generally use the above to connect, you could make do with a lot
less commands. Most of the stuff that you don't create explicitly will be
done
implicitly.
If you can't use a DSN then instead of DataConn.Open "DSN=pwd", use :
DataConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
server.MapPath("database.mdb")
where the mdb file must be in the same directory as the asp file.
Remi Lavictoire <r...@nisa.net> wrote in message
news:Wfiz5.11150$x6.7...@news1.gvcl1.bc.home.com...