Solved

Create field from openCDaoRecorset table

Posted on 1999-01-18
5
233 Views
Last Modified: 2010-05-18
How do I create a field in an existing table from a CDaoRecordset that is already open via CDaoRecordset::Open( ) ?  My my class name is m_csetExams deriverd from CDaoRecordset
0
Comment
Question by:Surfer
5 Comments
 
LVL 1

Expert Comment

by:Seeker092397
ID: 1184483
You cann't create new field in the table using CDaoRecordset. You have to open the table using CDaoTableDef and call its CreateField function.
0
 

Author Comment

by:Surfer
ID: 1184484
How do I create a field in an already created table using CDaoTableDef?  I have only seen exaples on using CDaoTableDef to create the table and then adding tables.  I get an error msg telling me the table is already open if a trie to open it.  This makes sence because the recordset is open to grat the table info.  Do I close the recordset and reopen it using CDaoTableDef?  This  seems like I am doing to much work.
0
 

Author Comment

by:Surfer
ID: 1184485
Adjusted points to 200
0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1184486
You cant open on an open database, if you wan't to restart it just call
depending on (.) no pointer, (->) pointer to member
mcSetExams(./->)Requery()

(I think that might do it.)

I will try to do it.  Could you tell me exactly what you are starting with and what you want to do. and what you will end with?

then I can try to help.

0
 
LVL 4

Accepted Solution

by:
pellep earned 200 total points
ID: 1184487
First you must call Close() in your CDaoRecordset. Then open a CDaoTableDef, call CreateField() and then call Append() to add the field to the fields collection. Now, close the tabledef and reopen your CDaoRecordset using the Open() command (with appropriate variables).
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

743 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