Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ado

Posted on 2001-06-27
4
Medium Priority
?
349 Views
Last Modified: 2013-11-23
I am tring to use ado object to execute a simple query on access database.

After I declared a connection varaiable I set the provider property to:

mConn.Provider = "Microsoft.Jet.OLEDB.4"

What should I write in

mConn.ConnectionString = ?

If the provider is Sql there is a way to create a file through the wizard open it by text editor and paste the
declaration , but I didn't see this possibility available when the provider is : Microsoft.Jet.OLEDB.4

Is there a way to create such a file ? If not what should be wriiten in the connection string ?


0
Comment
Question by:erezba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 400 total points
ID: 6230499
erezba, here is a sample connectionstring for an access database:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb;Persist Security Info=False"

You can omit the provider part as you have already specified it in the provider property or you can do it all in the one assignment.
0
 
LVL 4

Expert Comment

by:WolfgangKoenig
ID: 6230518
Hi erezba!

Here is the code for etablish a connection to oledb:
DBFilePath stands for the location of the database file
(for example: C:\data\customers.mdb):
___________________________________________________________
 Set adoconn = New ADODB.Connection
 With adoconn
  .Provider = "Microsoft.Jet.OLEDB.4"
  .ConnectionString = "Data Source=" & DBFilePath
  .CursorLocation = adUseClient
  .Mode = adModeShareDenyNone
  .Open
 End With
0
 

Author Comment

by:erezba
ID: 6230947
I still wonder if there is a way of creating a file
like sql server, from which all depfinition could be pasted,
instead of coding it and remembering the right syntax.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6231032
HOWTO: Generate ODBC & OLEDB Connection Strings with Data Links
Last reviewed: November 17, 1998
Article ID: Q195913
 


--------------------------------------------------------------------------------

The information in this article applies to:
Microsoft Data Access Components version 2.0


SUMMARY
Microsoft Data Links, provided with the Microsoft Data Access Components 2.0, provide a convenient and standard way to create and validate the connection string syntax used with an ODBC Driver or OLE DB Provider. Even if you do not reference the data link in your application, when you use Data Links to create your connection string, it validates the connection string syntax to be used with your ODBC Driver or OLE DB Provider.



MORE INFORMATION
Data Links are available after installing Visual Basic 6.0, Data Access SDK 2.0, or MDAC 2.0 Run-time Components. You can access Data Links from the Visual Basic 6.0 Data Environment, or from the Microsoft Windows shell, as outlined in the following steps:



Steps to Build a Connection String

Install Visual Basic 6.0, the Data Access 2.0 SDK, or MDAC 2.0 Run-time Components.

Right-click on the Windows desktop, point to New, and select Microsoft Data Link to create a Microsoft Data Link shortcut on your desktop (New Microsoft Data Link.udl).

Right-click the New Microsoft Data Link and click Properties to open the Data Link Properties dialog box. To create a connection to a datasource, use the CONNECTION tab.
NOTE: You can optionally use the ADVANCED and ALL tabs to set specific behavior available to either an ODBC or OLE DB data source.


Once you have completed and tested your connection, click OK to save your new data link.

Open your New Microsoft Data Link.udl file with Notepad (or other text editor). From the .udl file, you can copy the connection string and use it in your application that connects to an MDAC technology.  

Is probably as good an answer to this as you need.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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