Solved

How to open/connect to a ms access DB

Posted on 2006-11-29
6
1,096 Views
Last Modified: 2008-02-01
I'm looking for the script to open a Access DB from a proceedure in sql.  Then I need to create a recordset object and be able to refer records in that object.  here's the suedo code

open ACCDB
create recordset based on a customer name
      If the name doesn't exist in AccDB then create new record

I'm new to SQL scripting coming from a VB and C# background so my methods differ from sql scripting.

any code examples??
 

0
Comment
Question by:Steve7423
  • 3
  • 2
6 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 200 total points
ID: 18042506
Hi Steve7423,


This example accesses the orders table in the Microsoft Access Northwind database through the Microsoft OLE DB Provider for Jet.



Note  This example assumes that Access is installed.


USE pubs
GO
SELECT a.*
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
   'c:\MSOffice\Access\Samples\northwind.mdb';'admin';'mypwd', Orders)
   AS a
GO



Cheers!
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18042656
For a pure MS Access solution you should post in a more appropriate Topic Area such as:
http://www.experts-exchange.com/Databases/MS_Access/
0
 

Author Comment

by:Steve7423
ID: 18054702
aneeshattingal

Your assumption of Access installed is a good one.  it's very likely that in this case, Access will not be installed.  how will this change the script?

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Steve7423
ID: 18055258
Ok, I've researched Openrowset, the overall method is intreguing though it requires the provider and it's very likely there won't be one.

I'm trying to emulate VB code.

Example:

create a connection object to a database with user and PW
use the object to open tables in a Access DB and add records.

I'm trying to learn the proper script for this in SQL.  the syntax to do so differs between VB, .net, and SQL.

are there any other SQL methods to open databases?

0
 

Author Comment

by:Steve7423
ID: 18055829
I've played with this a bit and it meets my needs except the provider concerns me.

Question, If I'm accessing the mdb on a network computer that does not have Access installed, which coomputer does the provider need to be on.


Note: users have the option of copying the mdb file to any location on the network, regardless of jet installation.
 
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 50 total points
ID: 18056188
It is quite simple:  If you are using the JET provider the computer that is running the application must have the JET drivers installed (they do not need MS Access installed)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

813 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