Access Database Help
-
OK, I have made an app that parses a bunch of files and I have all the data stored into various arrays. I would like to be able to store this information into an Access database. I have no clue where to start on accessing Access and writing information to a database though. If anyone could help me out and point me in the right direction I'd be greatful! Adam cabadam@houston.rr.com
-
OK, I have made an app that parses a bunch of files and I have all the data stored into various arrays. I would like to be able to store this information into an Access database. I have no clue where to start on accessing Access and writing information to a database though. If anyone could help me out and point me in the right direction I'd be greatful! Adam cabadam@houston.rr.com
If you use MFC, CDaoDatabase and CDaoRecordset may help you. With the class wizard add a new CMyDaoRecordset and map the database fields into class members. You find examples on MSDN.
-
If you use MFC, CDaoDatabase and CDaoRecordset may help you. With the class wizard add a new CMyDaoRecordset and map the database fields into class members. You find examples on MSDN.
OK, but it gives me 'unrecognized database format' when creating the class and selecting which database I want to use... I am using Access 2000. Will that not work? Adam cabadam@houston.rr.com
-
OK, but it gives me 'unrecognized database format' when creating the class and selecting which database I want to use... I am using Access 2000. Will that not work? Adam cabadam@houston.rr.com
If you use Access 2000 you have to add an instruction in the CYourApp::Initinstance() The instruction is: AfxGetModuleState()->m_dwVersion = 0x0601; This work if you are linking with the MFC DLL. You can take a look at the Q236991 on MSDN for further details.
-
OK, but it gives me 'unrecognized database format' when creating the class and selecting which database I want to use... I am using Access 2000. Will that not work? Adam cabadam@houston.rr.com
Your right, ClassWizard doesn't support Jet 4.0 formatted files. Either create the file in Access 97 or you will have to create the record sets and bind them manually. There is another way to do this and use the generic recordset that is posted in the Database section. That is the way I go because I don't like all the recordset files that are required for each table within the file, source code can get quite large.
-
Your right, ClassWizard doesn't support Jet 4.0 formatted files. Either create the file in Access 97 or you will have to create the record sets and bind them manually. There is another way to do this and use the generic recordset that is posted in the Database section. That is the way I go because I don't like all the recordset files that are required for each table within the file, source code can get quite large.
[snip] There is another way to do this and use the generic recordset that is posted in the Database section. [/snip] What do you mean? This is my first venture into doing anythign with databases (at least programatically, I HAVE used Access before :)) I tried to look into the Enroll MFC sample, but it requires some database that you can't download from online (and I can't find my VStudio stuff right now...) Adam cabadam@houston.rr.com
-
[snip] There is another way to do this and use the generic recordset that is posted in the Database section. [/snip] What do you mean? This is my first venture into doing anythign with databases (at least programatically, I HAVE used Access before :)) I tried to look into the Enroll MFC sample, but it requires some database that you can't download from online (and I can't find my VStudio stuff right now...) Adam cabadam@houston.rr.com
In the Code Project's General section - Database area, there is an artical called "The CGeneric Database class". What this does is allow you to use the CGeneric recordset without binding the columns the way Class Wizard does. You can either set/get the column data via the calls like GetBool( "Column Name" ); or GetBool( column number ); This is a Dynamic way to use DAO vs the static way that Class Wizard does it. Also if you add new fields to the table, you don't have to rework the code, just add the new Get/Set routines.
-
OK, but it gives me 'unrecognized database format' when creating the class and selecting which database I want to use... I am using Access 2000. Will that not work? Adam cabadam@houston.rr.com
Visual Studio 6.0 Wizard don't support Access 2000. You must convert to Access 97 or use ODBC instead (Use CRecordset instead of CDaoRecordset)