Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CRecordset without DB Connection

Status
Not open for further replies.

smpaul

Programmer
Nov 13, 2002
7
0
0
GB
We have a VB application that dynamically constructs Recordsets from data retrieved from a DB, this allows various tables with various numbers of columns to be loaded without having to know each of the table schema. It uses the Recordset.Fields.Append functionality.

Is there the capablility in VC++ CRecordset / CDAORecordset to perform the same Recordset.Fields.Append functionality?
 
Is the VB application using ADO objects? If so the same COM objects can be used in C++.

-pete
 
We were hoping that there may have been a simpler object solution that we had not unearthed yet, however if it's the only way to go....

Thanks
 
No, it is not the only way to go. As you already stated there is the old MFC classes CRecordset etc., that provide ODBC connectivity. I don't think you would consider using them simpler.

There is also the COleDBRecordView class etc., that uses OLE DB and has some Wizard support in Visual C++. However since "simpler" is in the eye of the beholder, i don't find them simpler to use than the ADO interfaces. You may though so you might want to take a look at it. There are some sample OLE DB Visual C++ application on MSDN, as well as many articles and perhaps tutorials.

-pete
 
MFC Classes that will be of interest:

CDaoDatabase: Takes the filename and opens the db.

CDaoRecordset: Allows you to retrieve/save info from/to the database fields. Use the GetFieldValue/SetFieldValue methods.

CDaoTableDef: Allows you to contruct tables to add to the database. Add fields using the CreateField method and use the Append method to add the table to the database.

Hope this helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top