Luigi Posted June 2, 2004 Posted June 2, 2004 Hi, there is a method (DLL, native class...), using c#, to get list (and properties) of all DATA Providers installed on the running operating system ? I want develop a small DTS in wich you can select source and target database using any provider ! Thanks in advance Quote
pelikan Posted June 9, 2004 Posted June 9, 2004 Hi, there is a method (DLL, native class...), using c#, to get list (and properties) of all DATA Providers installed on the running operating system ? I want develop a small DTS in wich you can select source and target database using any provider ! Thanks in advance don't know if this is what you want but... you could use the Data Links dialog box (same one used by VS) 1. Add references to the librarys: Microsoft OLE DB Service Component 1.0 Microsoft ActiveX Data Objects 2.7 2. Launch the dialog and use the returned connection string MSDAC.DataLinks d = new MSDAC.DataLinksClass(); ADODB.Connection c = new ADODB.ConnectionClass(); d.PromptEdit( ref c ); Console.WriteLine( c.ConnectionString ); of course these are OLE DB connection strings. Quote IN PARVUM MULTUM
Joe Mamma Posted June 17, 2004 Posted June 17, 2004 Hi, there is a method (DLL, native class...), using c#, to get list (and properties) of all DATA Providers installed on the running operating system ? I want develop a small DTS in wich you can select source and target database using any provider ! Thanks in advance I think this will work (REQUIRES VC7) . . . create a C++ Class Library Project, Call it OLEDBSources Add a reference to the ADODB Interop assembly replace the text in the OLEDBSources.h file with this text: // OLEDBSources.h #pragma once using namespace System; namespace OLEDBSources { public __gc class RecordsetClass { public: static ADODB::Recordset* GetRecordset(void); }; } replace the text in the OLEDBSources.cpp file with this text: // This is the main DLL file. #include ".\stdafx.h" #include ".\oledbsources.h" #include <oledb.h> #include <msdaguid.h> #include "OLEDBSources.h" ADODB::Recordset* OLEDBSources::RecordsetClass::GetRecordset(void) { ADODB::Recordset* SourcesRecordset = new ADODB::RecordsetClass(); ADODB::ADORecordsetConstruction *RSCon = dynamic_cast<ADODB::ADORecordsetConstruction *>(SourcesRecordset) ; ISourcesRowset *SourcesRowset; CoCreateInstance(CLSID_OLEDB_ENUMERATOR, NULL, CLSCTX_ALL, IID_ISourcesRowset,(void **) &SourcesRowset); Object* pIRowset; DBPROPSET rgPropSets[1]; SourcesRowset -> GetSourcesRowset (NULL, IID_IRowset, 1, rgPropSets, (IUnknown**) &pIRowset); RSCon -> Rowset = pIRowset; return SourcesRecordset; } NOTE. . . I HAD TO CHANGE A LINE IN THE OCIDL.H!!! Specifically: in the typedef of tagQACONTAINER, I had to change IServiceProvider *pServiceProvider; to LPSERVICEPROVIDER *pServiceProvider; to overcome an ambiguous reference. . . I am probably doing something wrong in my project file. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.