Running 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.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?

Thanks... Steve

<!--#include file="adovbs.inc"-->
<%
dim strconn
dim rs
dim conn
strconn="Provider=Microsoft.Het.OLEBD.3.51; 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

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>
 

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

Top