wsproperties
MIS
I have sample code to be used in a conncetion string for an Access table using dreamweaver as an editor. When I preview the webpage on my local server,
1. I get an error message. Compiler Error Message: BC30451: Name 'RS' is not declared. Line 10 creates the error. Line 10: Do While Not RS.EOF.
I inserted a dim statement for oleDbDataReader, so Why am I getting an error message? It implies I didnt declare rs
2. In addition the database table rests in my folder. Therefore is server mappath correct? I do ot have a folder named db but since the table rests in is that statement appropriate?
Set dbaseConn = Server.CreateObject("ADODB.Connection")
dbaseConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("\db\myDatabase.mdb") & ";"
SQLQuery = "SELECT * FROM Test1"
dim rs as oleDbDataReader
Set RS = dbaseConn.Execute(SQLQuery)
%>
<%
Do While Not RS.EOF
%>
<%=RS("id")%>, <%=RS("last")%>, <%=RS("first")%> DM
<p>
<%
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
dbaseConn.Close
Set dbaseConn = Nothing
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
1. I get an error message. Compiler Error Message: BC30451: Name 'RS' is not declared. Line 10 creates the error. Line 10: Do While Not RS.EOF.
I inserted a dim statement for oleDbDataReader, so Why am I getting an error message? It implies I didnt declare rs
2. In addition the database table rests in my folder. Therefore is server mappath correct? I do ot have a folder named db but since the table rests in is that statement appropriate?
Set dbaseConn = Server.CreateObject("ADODB.Connection")
dbaseConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("\db\myDatabase.mdb") & ";"
SQLQuery = "SELECT * FROM Test1"
dim rs as oleDbDataReader
Set RS = dbaseConn.Execute(SQLQuery)
%>
<%
Do While Not RS.EOF
%>
<%=RS("id")%>, <%=RS("last")%>, <%=RS("first")%> DM
<p>
<%
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
dbaseConn.Close
Set dbaseConn = Nothing
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>