Re: Extracting an ADO ConnectString from an OLE DB provider
Christer Ljung <[email protected]> Tue, 26 Nov 2002 13:21:30 -0800
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <[email protected]> |
Well, I should have read MSDN more carefully before submitting this question. I found the answer
myself.
If I do
CComPtr<IDataInitialize> spIDataInitialize;
LPOLESTR pwszInitString = 0;
hr = spIDataInitialize.CoCreateInstance( CLSID_MSDAINITIALIZE, 0, CLSCTX_INPROC_SERVER );
hr = spIDataInitialize->GetInitializationString( (IUnknown*)spIDBInitialize
, true, &pwszInitString );
after doing spIDBInitialize->PromptDataSource, I get what I want.
/Christer
--- Christer Ljung <[email protected]> wrote:
> I'm trying to develop a general purpose connect-to-datasource dialog in a C++ program.
>
> It should return a ConnectString that could be given to the ADO Connection object later so that
> the program can connect to arbitrary datasource through ADO using an OLE DB provider. The idea
> is
> that the user should not be an expert in typing in a ConnectString and could use the dialog for
> help.
>
> I did experiment with the PromptDataSource (see below) to launch the standard dialog, but how do
> I
> extract a ConnectString out of the OLE DB provider? I can get a lot of properties, but that
> leaves
> be to assemble a ConnectString on my own, and I'm back to square one.
>
> spIDBPromptInitialize->PromptDataSource( 0, hWnd
> , DBPROMPTOPTIONS_PROPERTYSHEET, 0, 0, 0
> , IID_IDBInitialize, (IUnknown**)&pIDBInitialize
>
> Is there some property that returns what I'm looking for?
>
> Best Regards,
> Christer
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
> or subscribe to other DevelopMentor lists at http://discuss.develop.com.
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.