Connect to Access 2002 on local computer

S

Steve

Here's the code I'm trying to use; basic ASP code and it just reads the
records in the database: I want to use it on my local computer where this
file "ReadRecords.asp" and the "calgarywebconcepts_Master.mdb" file are both
in the Inventory directory. I'm using Access 2002 and my problem seems to be
in how I'm trying to connect to the database (the first 13 lines). Can
anyone see a problem with this?

I connect very well on my website using:
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "calgarywebconcepts_Master"

set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Inventory", conn, adOpenStatic, adLockOptimistic, adCmdTable

BUT... I want to set up a database on my local computer and use some of my
asp files (through frontpage).

Thanks... Steve

<!--#include file="adovbs.inc"-->
<%
dim strconn
dim rs
dim conn
strconn="Provider=Microsoft.Het.OLEBD.3.51; Data
Source=C:\Inventory\calgarywebconcepts_Master.mdb"

set conn = Server.CreateObject("ADODB.Connection")
conn.Open "strconn"

set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Inventory", conn, adOpenStatic, adLockOptimistic, adCmdTable

Response.Write "<TABLE BORDER=""1"" CELLSPACING=""2"" CELLPADDING=""2"">" &
vbCrLf
Response.Write vbTab & "<TR>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Department</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>ItemNo</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>ItemName</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Description</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Price</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Quantity</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>DateAdded</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>DateSold</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>DateTransferred</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>DateReturned</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>PictureSmall</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>PictureLarge</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Color</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Size</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Special</B></TD>" & vbCrLf
Response.Write vbTab & vbTab & "<TD><B>Discount</B></TD>" & vbCrLf

Response.Write vbTab & "</TR>" & vbCrLf
If Not rs.EOF Then
rs.MoveFirst
'Show data
Do While Not rs.EOF
Response.Write vbTab & "<TR>" & vbCrLf
For I = 0 To rs.Fields.Count - 1
Response.Write vbTab & vbTab & "<TD>" & rs.Fields(I) & "</TD>" & vbCrLf
Next
Response.Write vbTab & "</TR>" & vbCrLf
rs.MoveNext
Loop
End If
Response.Write "</TABLE>" & vbCrLf

rs.Close
set rs=nothing 'Close Recordset Object
conn.Close
Set conn=Nothing 'Delete connection Object
%>
<html>

<head>
<title>ReadRecords.asp</title>
</head>

<body BACKGROUND="images/bkg_white.jpg">
</body>
</html>
 
S

Steve

I've since changed my connection code to:
<!--#include file="adovbs.inc"-->
<%
dim strconn
dim rs
dim conn
strconn="Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Inventory\calgarywebconcepts.mdb;"
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "strconn"

set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Inventory", conn, adOpenStatic, adLockOptimistic, adCmdTable



But still with no results... And there are no error messages. Do you see
anything wrong with the changes?
Thanks... Steve
 
R

Roland Hall

in message : I've since changed my connection code to:
<!--SNiP-->

Steve...

Please do not multipost.
Please follow up in original thread in m.p.scripting.asp.db

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top