Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ADO in a DLL

Status
Not open for further replies.

ramass

Programmer
Jul 10, 2001
19
0
0
FR
I try to use a ADO component and export it in a DLL library. When I run it with an other program with the debugger, the only object returned 'CreateInstance' is a NULL pointer one.

Could you help me please ?

here below, the function :
Code:
MYDCLSPEC short _stdcall connectDB()
{
	HRESULT hr = NOERROR;
	IADORecordBinding *piAdoRecordBinding = NULL;
	strConnection = _T("Provider=MSDAORA.1;Password=seat;User ID=seat;Data Source=seatecole;Persist Security Info=True");
	strCmdText = _T("select *  from tbl_cible");
	RS_seat = NULL;
	try
	{             RS_seat.CreateInstance(__uuidof(Recordset));
		RS_seat->CursorLocation = adUseClient;

		( .................. etc ............... )

	}
	catch (_com_error )
	{
		return 1;
	}

	if (piAdoRecordBinding)
		piAdoRecordBinding->Release();

	return 0;
}
and the calling program :
Code:
#include "C:\Recup\manipOracleC\dllBD\dllBD.h"

int main(int argc, char* argv[])
{
  ( ................ )

// Test de la base de donnée
 	if ( (resultat = connectDB()) == 1) {
		printf("Bad Connection\n");
		return 0;
	}
 ( .................. )
}

tanks for replying
 
Does your code in the dll sure work?
If so begin with CoInitialize(NULL). Maybe it'll help. John Fill
1c.bmp


ivfmd@mail.md
 
OK. I have just forgotten the line
Code:
::CoInitialize(NULL)[\code]

Thanks

Matthieu Turpault
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top