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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I connect to a database on our WEB site?

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
web site = Its a front Page Website
and the database is in the fpdb folder
the datbase name is users.mdbThere is no password on the database but there is a username and password to get into the WEB site
the username is happyuser and p_ssw_rd is unhappy
I need a connection string
ADO if possible
I want to do this in a local Access database this is what I got from somewhere else
Code:
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset

   'Create a new ADO Connection object
    Set cn = New ADODB.Connection

    cn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=http:\\[URL unfurl="true"]www.mysite.com\fpdb\users.mdb"[/URL]
   'set its properties
   Set rs = New ADODB.Recordset
   With rs
      Set .ActiveConnection = cn
      .Source = "SELECT PartNo, Count(Inventory.PartNo) AS CountOfPartNo FROM Inventory" 
              .LockType = adLockOptimistic
      .CursorType = adOpenKeyset
      .Open
   End With
   rs.MoveLast
   rs.MoveFirst



DougP, MCP, A+
 
This is what I use:

[tt]dbfile=Server.MapPath("..\..\Afolder\Tek-Tips.mdb")
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & dbfile & ";" [/tt]

Make sure you have set full permissions for users on the folder where the database is kept.
 
Access does not reconize Server.mapPath
I want to use this inside of another Access database that is local on my computer.
Use VBA code not VBscript to open a database on the WEB site
Maybe it's not possible.
I know you can open a SQL Server database that way

DougP, MCP, A+
 
You can use the same connection string in VBA, just get rid of the map path and server bits:
[tt]dbfile="C:\Afolder\Tek-Tips.mdb"
Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & dbfile & ";"[/tt]

But I am now not sure what you wish to do, still, a connection string is a connection string.
 
does not work
I found this but it is still missing something
Code:
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset

   'Create a new ADO Connection object
    Set cn = New ADODB.Connection

    cn.Open "Provider=MS Remote; Remote Server=[URL unfurl="true"]http://www.mysite.com;[/URL] Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=fpdb/users.mdb"

    'set its properties
    Set rs = New ADODB.Recordset
    SQLCode = "SELECT * from WebSiteUsers"
    rs.Open SQLCode, cn, adOpenStatic, adLockOptimistic  << error on this line
    rs.MoveLast
    rs.MoveFirst
    For a = 1 To rs.RecordCount
        Debug.Print
    Next

    Set rs = Nothing
    Set cn = Nothing

gives error
Internal Server Error: Object/module not found

DougP, MCP, A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top