Solved

Fields and Tables of the DataBase Created from VB5.0

Posted on 1998-09-09
3
180 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 21
configuration management 2 100
sumDigits challenge 9 98
sumHeights2  challenge 7 76
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

17 Experts available now in Live!

Get 1:1 Help Now