CDaoRecordset::GetFieldValue Error 
Author Message
 CDaoRecordset::GetFieldValue Error

Hi,

when using the call to:

CDaoRecordset *RS;
...
...
...
...
COleVariant temp
RS->GetFieldValue(TableName, temp);
CString another_temp = temp.bstrVal;

I always get an error when running GetFieldValue that says "Item not
found in this collection."  All of the #includes are there, the path
name is correct, because I can write to the Database, but it won't let
me read in values from it.  Can anyone help.  I think part of the
problem is that the text is being stored in the pbVal member rather
than the bstrVal member, but I cannot get that to work either.  Any
help would be greatly appreciated.

Thanks.

Jeff Johnson

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 31 Jan 2003 03:00:00 GMT  
 CDaoRecordset::GetFieldValue Error

Quote:

>COleVariant temp
>RS->GetFieldValue(TableName, temp);
>CString another_temp = temp.bstrVal;

>I always get an error when running GetFieldValue that says "Item not
>found in this collection."  All of the #includes are there, the path

[snip]

Your problem is that you obviously misplaced TableName variable.
GetFieldValue() wants a field name not a table name. The proper way to
do this is:

RS->Open (dbOpenTable, TableName);
/* set an index */
/* seek to a record */
RS->GetFieldValue ("my field name", temp);

... or you can...

RS->Open (dbOpenSnapshot, "SELECT * FROM my_table");
/* etc */

HTH
--
Alex.

Waver: Multiprocessor WAV and MP3 converter
http://waver.htmlplanet.com
**SPAM FREE REPLY ADDRESS



Sat, 01 Feb 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CDaoRecordset::GetFieldValue returns {"?"}

2. cdaorecordset::GetFieldValue --> variant

3. cdaorecordset::GetFieldValue --> variant

4. ?CDaoRecordset::GetFieldValue doesn't put string in .bstrVal

5. CDaoRecordset GetFieldValue

6. CDaoRecordset.Update() is messing up GetFieldValue return

7. Possible BUG in CDaoRecordset::GetFieldValue()

8. CDaoRecordSet -- CDaoRecordSet -- CDaoRecordSet

9. CDaoRecordset/CDaoQueryDef Error (OverFlow Error)

10. run time error with GetFieldValue function

11. VC++ 6.0 CRecordSet::GetFieldValue throws Memory Error

12. GetFieldValue error problem

 

 
Powered by phpBB® Forum Software