Solved

Ado

Posted on 2001-06-27
4
345 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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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