Does anyone know of any books that explain connecting to Access Databses using C++ console mode...
Also any online tutorials or code snippets would be good!
Does anyone know of any books that explain connecting to Access Databses using C++ console mode...
Also any online tutorials or code snippets would be good!
you can't just flat out access a database like MS access or something....I'm not sure how some of the higher end db's work like oracle and the like....it also depends on what one you plan to interface with, some have different commands, some even organize themselves differently. You're better off making your own database than trying to hack and access other db's from an app, it'd take less time and effort. If you plan on making a front-end program to something like MS access, use visual basic, not c++.
Any other questions?
PHP and XML
Let's talk about SAX
what... i have seen it done?
straight through C++, also i have created my own DB and no it is not as simple as just connecting to an ACCESS DB..
o well anyone else?
Here ya go.. i just need an explanation on how it is working... i understand how to access them in VBscript for ASP and it seems similar but there is still some syntax that i do not understand!Code://************************************** // // Name: Access MDB // Description:To open MS Access or Ms S // QL server database using C/C++ or VC++ // By: Mokarrabin A Rahman // // Returns:Shows some recordsets // // Assumes:Change the name of the databa // se to any database and place it in the s // ame directory as the .exe. You shoul als // o change the SQL to your particular data // base. You may change the connect string // to connect to MS SQL Server. // // Side Effects:Great // //This code is copyrighted and has// limited warranties.Please see http:// // www.Planet-Source-Code.com/xq/ASP/txtCod // eId.1371/lngWId.3/qx/vb/scripts/ShowCode // .htm//for details.//************************************** // #import "c:\Program Files\Common Files\System\ADO\msado15.dll" \ no_namespace rename("EOF", "EndOfFile") // This code comes from : www.geocities. // com/mokarrabin #include <stdio.h> #include <iostream.h> void main(void) { CoInitialize(NULL); try { _RecordsetPtr pRst("ADODB.Recordset"); // Connection String _bstr_t strCnn("DRIVER={Microsoft Access Driver (*.mdb)};UID=admin;DBQ=GBOOK.mdb"); // Open table pRst->Open("SELECT * FROM ProductService where ProductService like '%samir%';", strCnn, adOpenStatic, adLockReadOnly, adCmdText); pRst->MoveFirst(); while (!pRst->EndOfFile) { cout<<(char*) ((_bstr_t) pRst->GetFields()->GetItem("ProductService")->GetValue())<<endl; pRst->MoveNext(); } pRst->Close(); } catch (_com_error &e) { cout<<(char*) e.Description(); } ::CoUninitialize(); }
well, im not sure what you need broken down....but this is the important part right here:
it has a pointer to a file, and while there's still data left (not the end of the file) it spits out the text within the feilds. Then it moves on to the next feild........it shows nothing on how to send the recordset new data and the like.....you'll have to dig deeper to find out how to do that. The reason i thought it would be so difficult is that i had not known someone had already found out how to use the access dll in this manner.Code:while (!pRst->EndOfFile) { cout<<(char*) ((_bstr_t) pRst->GetFields()->GetItem("ProductService")->GetValue())<<endl; pRst->MoveNext(); }
PHP and XML
Let's talk about SAX
understandable.. if anyone else know how to use this please post some links or a book
thanx!
Know any good tutorials or free online books that cover that topic ?Originally posted by Waldo2k2
You're better off making your own database than trying to hack and access other db's from an app, it'd take less time and effort.
Any other questions?
Cheers.
i might as well write one
as long as you don't mind waiting a week
PHP and XML
Let's talk about SAX
I can wait a week for information like that!Originally posted by Waldo2k2
i might as well write one
as long as you don't mind waiting a week
Oh, and I like Perl for database interfacing, but I've only used it with Oracle, not Access.
Claus Hetzer
Compiler: Borland 5.5 (on Windows)
Solaris CC (on Unix)
Known Languages: C++, MATLAB, Perl, Java
Thats brilliantOriginally posted by Waldo2k2
i might as well write one
as long as you don't mind waiting a week
I'm just guessing here... But Access is ODBC compliant (Open Database Connectivity). So you may want to look-up information on writing ODBC applications. As I understand it, this is how Crystal Reports works... by interfacing with the ODBC database.
You might look into OLE (Object Linking and Embedding) and DAO (Direct Object Access) too.