CDaoRecordset can't find record 
Author Message
 CDaoRecordset can't find record

Note the following:

CDaoDatabase m_DB;
m_DB.Open("\\filedb.mdb");
CDaoRecordset rs(&m_DB);
rs.Open(dbOpenDynaset,_T("select dra_num from dbtable where dra_num =
'4D-011397'", dbReadOnly);

PROBLEM:
The value '4D-011397' is a known value in the database table dbtable.
But the rs.Open statement  ( with the SQL select statement ) does not
"find" the record. The rs.Open() statement throws an exception which
reports the error "Item not found in this collection".  There is
nothing complex about this code -- very straight forward. Any ideas
or suggestions/solutions?

THANKS!!

Dale



Mon, 26 Jul 1999 03:00:00 GMT  
 CDaoRecordset can't find record

My first guess would be that the name of the field is wrong (at least then
you get the same message).  But if so, you have worked it out by now...

Czarek



Quote:
> Note the following:

> CDaoDatabase m_DB;
> m_DB.Open("\\filedb.mdb");
> CDaoRecordset rs(&m_DB);
> rs.Open(dbOpenDynaset,_T("select dra_num from dbtable where dra_num =
> '4D-011397'", dbReadOnly);

> PROBLEM:
> The value '4D-011397' is a known value in the database table dbtable.
> But the rs.Open statement  ( with the SQL select statement ) does not
> "find" the record. The rs.Open() statement throws an exception which
> reports the error "Item not found in this collection".  There is
> nothing complex about this code -- very straight forward. Any ideas
> or suggestions/solutions?

> THANKS!!

> Dale



Mon, 26 Jul 1999 03:00:00 GMT  
 CDaoRecordset can't find record

Quote:

> Note the following:

> CDaoDatabase m_DB;
> m_DB.Open("\\filedb.mdb");
> CDaoRecordset rs(&m_DB);
> rs.Open(dbOpenDynaset,_T("select dra_num from dbtable where dra_num =
> '4D-011397'", dbReadOnly);

> PROBLEM:
> The value '4D-011397' is a known value in the database table dbtable.
> But the rs.Open statement  ( with the SQL select statement ) does not
> "find" the record. The rs.Open() statement throws an exception which
> reports the error "Item not found in this collection".  There is
> nothing complex about this code -- very straight forward. Any ideas
> or suggestions/solutions?

> THANKS!!

> Dale

Never mind. I found my problem. Thanks to those who offered any help.

Dale



Tue, 27 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CDaoRecordset can't find record

2. Problem finding first record using CDaoRecordset class

3. Problem finding first record using CDaoRecordset

4. Classwizard don't find any record felds in ODBC DB

5. CDaoRecordset is returning 1 record when there isn't a record!!

6. CDaoRecordset is returning 1 record when there isn't a record!!

7. CDaoRecordSet -- CDaoRecordSet -- CDaoRecordSet

8. Reading records using MFC CDaoRecordSet (fast method required!)

9. How to use CDaoRecordset::AddNew to create new records

10. CDaoRecordset - adding new records

11. Editing CDaoRecordset records and values.

12. Deleting several records in CDaoRecordset

 

 
Powered by phpBB® Forum Software