Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OLE DB Data Link dialog

4 views
Skip to first unread message

Sandy Pham

unread,
Oct 3, 2003, 12:25:10 PM10/3/03
to
Is there a way in OleDb.net to display the OLE DB Data
Link dialog so that the user is prompted to choose a
provider?

Thanks,

Sandy

Steven Bras [MS]

unread,
Oct 3, 2003, 1:58:13 PM10/3/03
to
I don't believe there is native code to do this; you must set references to
both the "adodb" .Net assembly and the OLEDB32.dll via the COM references
list in your project.

This will add references to MSDASC and OLEDBError. Then use the following
code to obtain a valid OLE DB connection string:

Dim oOLE As New MSDASC.DataLinks
Dim oConn As ADODB.Connection

oConn = oOLE.PromptNew()

MessageBox.Show(oConn.ConnectionString)

The promptNew method returns an ADO connection object, from which you can
read the ConnectionString property. Be sure to destroy the ADO connection
object when you're done with it.

There's also a PromptEdit() method that accepts an ADODB connection object
as a parameter, and will display the data link dialog set to the connection
information it finds on that connection object.

Hope this helps!

Steven Bras, MCSD
Microsoft Developer Support/Data Access Technologies

This posting is provided "AS IS" with no warranties, and confers no rights.

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-026?  If not Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-026
http://www.microsoft.com/security/security_bulletins/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026.

0 new messages