Solved

Opening a Table with CDaoRecordset

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 125
Generic progress indicator 6 117
zeroFront challenge 7 99
Unix Command -- Challenging  question 7 92
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

821 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