Hello
I have some code - which I thought was quite straightforward! I am trying to connect to a MSAccess2000 database and to read a couple of fields in the database. It doesn't seem to work, and I wondered what I was doing wrong.
The code is:
<%
Option Explicit
Dim ConnectionString
Dim connObj
Dim sql
Dim oRS
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\testDB.mdb"
& ";
Set ConnObj = Server.CreateObject("ADODB.Connection"
connObj.Open ConnectionString
sql = "select * from Table1"
Set oRS = connObj.Execute(sql)
Do While Not oRS.EOF
Response.Write(oRS("girlFirst"
& " - " & oRS("girlSurname"
& "<br>"
oRS.MoveNext
Loop
oRS.Close
connObj.Close
Set oRS = Nothing
Set connObj = Nothing
%>
The error message I am getting (though I am not sure if this is the reason why I don't seem able to connect to the DB or read from it) is:
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/stevehigham/db/test.asp, line 10
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\testDB.mdb"
& ";
-----------------------------------------------------------------------------------------------------^
Thank you for any help.
LaPluma
I have some code - which I thought was quite straightforward! I am trying to connect to a MSAccess2000 database and to read a couple of fields in the database. It doesn't seem to work, and I wondered what I was doing wrong.
The code is:
<%
Option Explicit
Dim ConnectionString
Dim connObj
Dim sql
Dim oRS
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\testDB.mdb"
Set ConnObj = Server.CreateObject("ADODB.Connection"
connObj.Open ConnectionString
sql = "select * from Table1"
Set oRS = connObj.Execute(sql)
Do While Not oRS.EOF
Response.Write(oRS("girlFirst"
oRS.MoveNext
Loop
oRS.Close
connObj.Close
Set oRS = Nothing
Set connObj = Nothing
%>
The error message I am getting (though I am not sure if this is the reason why I don't seem able to connect to the DB or read from it) is:
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/stevehigham/db/test.asp, line 10
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\testDB.mdb"
-----------------------------------------------------------------------------------------------------^
Thank you for any help.
LaPluma