?
Solved

Fields and Tables of the DataBase Created from VB5.0

Posted on 1998-09-09
3
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 150 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 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