Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to use “RDS.Connect” to connect to a MS Access database?

    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

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,062
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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
    Code:
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •