|
From: Derek C. <der...@ho...> - 2003-04-19 17:47:46
|
Hi I have just started using dev c++ v4.98 and am experiencing problems connecting via ado to an access database using code that previously worked under visual studio 6. The code I have used previously is: #import "c:\program files\common files\system\ado\msado15.dll" \ // This code comes from : www.geocities.com/mokarrabin #include <stdio.h> #include <windows.h> #include <iostream> using namespace std; int memscan(void) { int istopped =1001; int flagged=1001; CoInitialize(NULL); char storeVal[100]; try { _RecordsetPtr pRst("ADODB.Recordset"); // Connection String _bstr_t strCnn("DRIVER={Microsoft Access Driver (*.mdb)};UID=admin;DBQ=data.mdb"); // Open table pRst->Open("SELECT * FROM tblProg", strCnn, adOpenStatic, adLockReadOnly, adCmdText); pRst->MoveFirst(); while (!pRst->EOF) { strcpy (storeVal,(char*) ((_bstr_t) pRst->GetFields()->GetItem("prog_process")->GetValue())); pRst->MoveNext(); } pRst->Close(); } catch (_com_error &e) { filewrite((char*) e.Description()); } ::CoUninitialize(); return 0; } This however generates to many warning and refuses to compile. Any alternative ideas would be appreciated. Regards Derek _________________________________________________________________ Hotmail now available on Australian mobile phones. Go to http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp |