problem using asp with database created with vba
Can someone please tell me why the following generates an error.
<% Option Explicit %>
<html>
<head>
<title>New Page</title>
</head>
<body>
<%
'************************************************* ***********************
' The DataStore file
'
'************************************************* ***********************
dim accessDB
dim strSource,oConn,oRS
'Find the full path of the database
accessDB=Server.MapPath("G:\Tafe\database_programm ing\vba\vba_assignment\vba_assignment.mdb")
'Use Microsoft Jet v4.0
strSource = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="strSource=strSource & accessDB & ";"
'*** set the connection object
set oConn=Server.CreateObject("ADODB.Connection")
'*** make the ConnectionString property the strSource from the DataStore file
'oConn.ConnectionString=strSource
'*** open the connection
'oConn.Open
oConn.Open strSource
set oRS = Server.CreateObject("ADODB.Recordset")
oRS.Open "tblCompanyDetails",oConn
do while not oRS.EOF
Response.Write(oRS("strCoName")) & "<br>" &
vbCrLf)
oRS.MoveNext
loop
%>
</body>
</html>
I've tried using slashes both ways for the .MapPath command. The error seems to be at srcSource = ... and it is called error 8. The idea was to display all strCoName stored in tblCompany details which is a table in a database stored in vba_assignment.mdb.
If it wasn't for the problem connecting to the database, would my code
display this info (assuming the correct name is used for the table etc)?
Dave
|