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

Connection to DB

Status
Not open for further replies.

vintl

Technical User
Jun 9, 2000
72
MY
I try 2 type of connection, but both failed. below describe the code and error.

1) set DBConn=server.CreateObject ("ADODB.Connection")
DBConn.open "dbtest"
set record=server.CreateObject ("ADODB.Recordset")

give me this error

ADODB.Connection error '800a0e7a'

ADO could not find the specified provider.

/test.asp, line 11

even i use below code also return the above error.

2) Dim DBConn
set DBConn=server.CreateObject ("ADODB.Connection")
DBConn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + "C:\Windows\Desktop\db.mdb")
set record=server.CreateObject ("ADODB.Recordset")

if i use the first code, how should i set the ODBC Data source setting?
I'm using local installed Microsoft Access 2000 with ASP running on PWS. which setting i should chose, System DSN or File DSN.
If i were to chose File DSN or System DSN, what is the step in setting up the connection to my database?
My Access database is located in c:\windows\desktop\db.mdb. Please help.

Thanks
vincent
 
I never used ODBC. The following code is very useful to me.

Assume my database is located here:
d:\db\mydata.mdb

<%
Option Explicit
Const PATH = &quot;d:\db\mydata.mdb&quot;
Const PROVIDER = &quot;Microsoft.Jet.OLEDB.4.0&quot;
Dim objCon, objRS
set objCon = Server.CreateObject(&quot;ADODB.Connection&quot;)
objCon.Provider = PROVIDER
objCon.Open(PATH)
set objRs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Dim strSql
strSql = &quot;select...&quot; 'something you needed.
objRs.Open strSql, objCon
.........

%>

if it doesn't work, feel free to tell me.
 
to ccat999
It does work. even i follow exactly your variable, it just didnt work. If i include the Option Explicit it return this error

Microsoft VBScript compilation error '800a0400'

Expected statement

/test.asp, line 8

Option Explicit
^

else if i don't include the Option Explicit, it return the same error

ADODB.Connection error '800a0e7a'

ADO could not find the specified provider.

/test.asp, line 14

Anything else I can try?
 
Reinstall office2000 if you use that.

When there is no Microsoft Access in my computer, the code contains database manipulition does not work. So I suspect that your ADO wrong.

If you give me more, maybe I'll give some suggestions.

Good Luck!
 
thx. it works after i reinstall the office package.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top