heyrung
May 29th, 2005, 01:42 PM
Hi
I have data structure in Visual C++ that I have to write a program/function to save to as a new MS-Access database file. I have no knowledge about how to deal with database thru C++, and I'm trying to find a way to do this.
I would like to make 2 tables out of that data structure, which are linked thru 1 key. I've read tutorial and tried some exercise, but none of them seems to perfectly fit what I want. After trying what the tutorial said (I make a database file in Access, add it to a new ODBC data source, and in VC++, I use CRecordset class to dump data into Access thru ODBC), I got some questions below.
1. Is there a way to save many records at one time? (now I use CRecordset, but I can only save one record at a time. I do this by open, add new, update, and close. So if I have 50 records, I have to do these set of steps 50 times which may take too long)
2. How do I save the data structure in VC++ into MS-Access as a new file every time I execute this function/program? (What I am doing now is I build a database file in MS-Access and overwrite it, but I can not save as a new file....and if I could, I wonder how I can skip adding new ODBC data source every time I save as a new database file.) Do u think ODBC is the right choice for me or do I need DAO?
Please also give me the link to the tutorial (for someone who starts from ground up) if you have one.
Thank you
I have data structure in Visual C++ that I have to write a program/function to save to as a new MS-Access database file. I have no knowledge about how to deal with database thru C++, and I'm trying to find a way to do this.
I would like to make 2 tables out of that data structure, which are linked thru 1 key. I've read tutorial and tried some exercise, but none of them seems to perfectly fit what I want. After trying what the tutorial said (I make a database file in Access, add it to a new ODBC data source, and in VC++, I use CRecordset class to dump data into Access thru ODBC), I got some questions below.
1. Is there a way to save many records at one time? (now I use CRecordset, but I can only save one record at a time. I do this by open, add new, update, and close. So if I have 50 records, I have to do these set of steps 50 times which may take too long)
2. How do I save the data structure in VC++ into MS-Access as a new file every time I execute this function/program? (What I am doing now is I build a database file in MS-Access and overwrite it, but I can not save as a new file....and if I could, I wonder how I can skip adding new ODBC data source every time I save as a new database file.) Do u think ODBC is the right choice for me or do I need DAO?
Please also give me the link to the tutorial (for someone who starts from ground up) if you have one.
Thank you