?
Solved

Opening a Table with CDaoRecordset

Posted on 1998-02-09
2
Medium Priority
?
248 Views
Last Modified: 2013-11-20
I have derived a class from CDaoRecordset that should access a table in an Access database (Access 97).  The table exists however it is empty.

Instead of doing a query, I want to add an entry to this table.  So I call Open() (with no parameters).  Unfortunately I get an exception that says:

"Too few parameters, expected 1."

I assume calling "Open" will open the table so I can use the "AddNew()" method.  The table was generated via ClassWizard so the default table and database name are hard-coded.
0
Comment
Question by:tdietz
[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
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1315843
You need to use the Open() that takes a CDaoTableDef*.

  CDaoTableDef tableDef;
  tableDef.Open("MyTable");
  CDaoRecordset rs;
  rs.Open(&tableDef);
  rs.AddNew();
  rs.Update();

0
 

Expert Comment

by:mmachie
ID: 1315844
Remember CDaoTableDef is only valid for table-type recordsets.  Are you  sure you bound the columns you want?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 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