Solved

Opening a Table with CDaoRecordset

Posted on 1998-02-09
2
238 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 127
Pressing cancel button with C# UI Automation 3 82
fix34  challenge 9 148
x-bar in Google Sheets 2 72
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‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

820 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