Solved

Opening a Table with CDaoRecordset

Posted on 1998-02-09
2
233 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
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 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

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

19 Experts available now in Live!

Get 1:1 Help Now