Solved

Fields and Tables of the DataBase Created from VB5.0

Posted on 1998-09-09
3
199 Views
Last Modified: 2013-11-20
Hi,

I have created a database from VB5.0.
I want to ask whether I can open this database from
Visual C++ 5.0 wihtout knowing the name of the fields and table of the database.

Because I find if I use this function CDaoRecordSet::SetFieldValue() or CDaoRecordSet::GetFieldValue()

I need to know the field of the database
eg. CDaoRecordset *m_pRSDlg;
    m_pRSDlg->SetFieldValue(_T("Name of the field"),"the input data to the database");

Also, when I try to open the database, I also need to know
the name of the table:
eg. m_pRSDlg->Open(dbOpenDynaset,_T("Select * from [Users]");

Thus, if I have a database not created by me, how can I
open it and do some data modification on it?

Thanks
P.S. Can it be done on using the class CDaoRecordSet
0
Comment
Question by:ee_lcpaa
3 Comments
 
LVL 2

Expert Comment

by:rayb
ID: 1322001
You can find all sorts of things out about the database through code.  Look at some of the other methods of CDaoDatabase, specifically the GetTableDefInfo method.  You can also alter the database through the DAO C++ classes.  Good luck!
0
 

Accepted Solution

by:
bobbym earned 50 total points
ID: 1322002
Dear lc_paaa,
You can use CDaoRecordset::m_nFields to estimate the number of fields in a table and GetFieldValue(), SetFieldValue with index, not with a field name. But unfortunately you can not do that using the CDaoDatabase.
 So you have to touch here a little deeper I suggest :
1. Consider using the SDK C++ DAO classes that give you a full control over the hierachy and also are much, much like VB objects,

or

2. If you still want to use the CDaoXXXX classes of MFC you will have to manipulate the underlying Automation objects by yourself. You can read a Technical Note on this matter (I don't remember the number right now).

Hope this helped :)
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1322003
Using the CDaoTableDef, CDaoTableDefInfo classes with CDaoDatabase, you can obtain the table information.
For field information, use the CDaoFieldInfo class
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 82
Tab names are off by one 5 54
How to determine file rename from EventLog ? 2 49
"Black Box" Testing of Control System Software 2 48
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now