Donate SIGN UP

Database Connectivity using ADO

Avatar Image
mufazzal | 00:13 Tue 08th Oct 2002 | Technology
1 Answers
I want to connect my application written in VC++ version 6 .....to a MS Access Database using ADO .....i have attached the source code below ......it is compiling and linking properly but there is no output for some strange reasons ....i have made the logical connection of the database from the System DSN in Control Panel and have successfully tested it ..... but nothing is happening .....i have used the Sample 'Northwind.mdb' database present in MS Access and placed it on the root of C Drive and the connection string is 'xxx' ......so could some1 check my code and point out my errors .......thanx in advance // xyz.cpp : Defines the entry point for the application. // #include 'stdafx.h' #include #include #include #import 'c:\Program Files\Common Files\System\ADO\msado15.dll' \ no_namespace rename('EOF', 'EndOfFile') int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) //int main(void) { CoInitialize(NULL); try { _RecordsetPtr pRst('ADODB.Recordset'); // Connection String _bstr_t strCnn('DRIVER={Microsoft Access Driver (*.mdb)};UID=admin;DBQ=Northwind.mdb'); // Open table pRst->Open('SELECT Customer FROM Orders*;', strCnn, adOpenStatic, adLockReadOnly, adCmdText); pRst->MoveFirst(); while (!pRst->EndOfFile) { cout<<(char*) ((_bstr_t) pRst->GetFields()->GetItem('xxx')->GetValue())<MoveNext(); } pRst->Close(); } catch (_com_error &e) { cout<<(char*) e.Description(); getch(); } ::CoUninitialize(); return 0; }
Gravatar

Answers

Only 1 answerrss feed

Best Answer

No best answer has yet been selected by mufazzal. Once a best answer has been selected, it will be shown here.

For more on marking an answer as the "Best Answer", please visit our FAQ.
try pocketprojects.com has loads of forums on embedded C++ and eVB. I have only ever written using eVB.

Only 1 answerrss feed

Do you know the answer?

Database Connectivity using ADO

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.