Solved

Error inserting into MDB.

Posted on 2004-04-12
4
346 Views
Last Modified: 2006-11-17
Hi
I am getting an error when I try to insert to my mdb database

my connection is being set up using:

Set OpenDB = Server.CreateObject("ADODB.Connection")
OpenDB.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db.mdb")

and i am recieving the following error:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'Provider=MSDASQL.1;E'

Any ideas would be appreciated!

Thanks



0
Comment
Question by:pinmj001
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 10804344
Try using OLEDB Connection instead:

Example:

set OpenDB =server.CreateObject("adodb.connection")
OpenDB.Open "Provider=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("../db.mdb")

..

More info regarding ConnectionString available at:            

http://www.able-consulting.com/ADO_Conn.htm
http://www.connectionstrings.com

cheers
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10804507
Make sure you have the latest version of MDAC installed in your server. Otherwise, try changing the connection string as mentioned by ryancys.

Cheers!!
0
 
LVL 21

Accepted Solution

by:
ap_sajith earned 500 total points
ID: 10804518
Are you trying to open the connection inside a function?. If so, you need to use the Set keyword to assign the connection to the function..

eg:

Public Function openConnection()
Dim ConnectionString
Dim Connection

ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};"
ConnectionString=ConnectionString & "DBQ=" & accessdb

Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open(ConnectionString)

Set openConnection = Connection '** MAKE SURE TO USE SET KEYWORD **
End Function

Cheers!!
0
 

Author Comment

by:pinmj001
ID: 10804913
Thanks you were correct, I had to call the function using set

Cheers!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now