Solved

Fields and Tables of the DataBase Created from VB5.0

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

728 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