Solved

Create field from openCDaoRecorset table

Posted on 1999-01-18
5
234 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

895 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