...

View Full Version : How to use “RDS.Connect” to connect to a MS Access database?



stephen78751
08-02-2004, 11:25 PM
The example I am working from uses the following code which does not work:
RDS.Connect = "Provider='sqloledb';Integrated Security='SSPI';Initial

So I tried the following, but still no go. Any help would be greatly appreciated!
Thanks in advance,
Stephen

dim conn
dim strconn

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & _
Server.MapPath("/fpdb/users.mdb")

set conn = server.createobject("adodb.connection")
conn.open strconn

'Create the recordset object
set rs = server.createobject("adodb.recordset")
rs.open "my_users", conn, 2, 2

'set RDS properties for control just created
RDS.Server = "http://<%=Request.ServerVariables("SERVER_NAME")%>"
RDS.Connect = conn
RDS.SQL = "Select * from my_users"
RDS.Refresh

miranda
08-03-2004, 05:52 PM
First off here is a lesson to help you debug. Put this tag at the top of every page that you creat in VBScript.
<% Option Explicit %> that way any implicitly declared variables are not used.


OK that said look at your code. You have a recordset object called rs but you are then trying to work with it under RDS. So change the code to this


dim conn, strconn, rs

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & _
Server.MapPath("/fpdb/users.mdb")

set conn = server.createobject("adodb.connection")
conn.open strconn

'Create the recordset object
set rs = server.createobject("adodb.recordset")
rs.open "my_users", conn, 2, 2

'set recordset properties for control just created
rs.Server = "http://<%=Request.ServerVariables("SERVER_NAME")%>"
rs.Connect = conn
rs.SQL = "Select * from my_users"
rs.Refresh



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum