Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection String Using asp.net and Dreamweaver

Status
Not open for further replies.
Jun 11, 2008
34
US
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>
 
this looks alot like asp not asp.net. forum333 is dedicated to asp.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
My mistake Actually I am in an asp.net environment. So how would I get the connection string to work in this case? And did you see my follow up question about the path of where the database is housed on the server?
 
if this is asp.net then you need to learn about asp.net, how it's different from asp and specifically for this problem understand how to use ADO.Net.

the above code looks like your using asp techniques with asp.net. If that's the case just use asp and drop asp.net.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top