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

Frontpage/ASP creating a manual connection to an Access database.

Status
Not open for further replies.

blackmagicwoman

Programmer
Feb 1, 2007
1
CA
I need some help with creating a manual connection to an Access database within Frontpage. I've created a simple ASP to accept a name and email address with buttons to subscribe(add) or unsubscribe(delete).

I have the page working perfectly outside the Frontpage software using IIS and a DSNless connection. The database is adding and deleting records perfectly.

I've tried variations of connecting to the database as you will see commented out. I created a connection using the database wizard in FrontPage and then used the "Application" connection string from the global.asa that FrontPage creates. That doesn't work either. Nothing seems to be working to connect.

Here are some of the things I've tried:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
<%
Function OpenDatabase()
Set oConn = Server.CreateObject("ADODB.Connection")

'**Use Application connection string from Global.asa
'Application("vwNEWsclients_ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=fpdb/vwNEWSclients.mdb"
'oConn.Open Application("vwNEWsclients_ConnectionString")

'**Providers
Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"

'Provider = "DRIVER={Microsoft Access Driver (*.mdb)};"

'**Paths
'Path = "DBQ=URL=fpdb/vwNEWSclients.mdb"

Path = "DBQ=URL=" & Server.MapPath("fpdb/vwNEWSclients.mdb") & ";'

'Path = "Data Source=fpdb/vwNEWSclients.mdb"'

'**Open database connection using provider and path
oConn.Open Provider & Path

End Function


I know for sure that the SQL statements I am using work fine as the page works great outside of FrontPage. The connection to the database is the issue.

I do not want to use the database wizard. The ASP is working outside FrontPage. I brought the ASP into Frontpage and am trying to setup the connection manually. I am not new to FrontPage or Access but I am relatively new to ASP and ADO.

If anyone out there can help me with this I would greatly appreciate it.

Thanks in advance,
Maggs
 
You were almost there. Just don't use global.asa because the DSN may not be set up correctly. Try a DSN-less connection
Code:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
<%
Function OpenDatabase()
Set oConn = Server.CreateObject("ADODB.Connection")

'**Providers
' Don't use Jet - it may work or fail depending on which 
' version of office is installed.
'Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"

Provider = "DRIVER={Microsoft Access Driver (*.mdb)};"

'**Paths
'Path = "DBQ=URL=fpdb/vwNEWSclients.mdb"

Path = "DBQ=" & Server.MapPath("fpdb/vwNEWSclients.mdb") & ";"

'Path = "Data Source=fpdb/vwNEWSclients.mdb"'

'**Open database connection using provider and path
oConn.Open Provider & Path

End Function

What you can try on the command line, just to satisfy yourself that it works is to

1) rename the .asp to .vbs
2) remove the <% and %>
3) remove all Server.
4) Just do an open using select * from table.

Just check if that works. If it doesn't, you may need to prefix the path with ./
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top