cdaorecordset::GetFieldValue --> variant 
Author Message
 cdaorecordset::GetFieldValue --> variant

hi --

i'm trying to retrieve a string from a CDaoRecordSet using
GetFieldValue(), but am getting some strange return values.

Note: Most of this code is from Bob Place's GenericRecordSet
class on codeguru, i recommend it.

CString GenericRecordset::GetCString(CString ColumnName) {
        COleVariant covFieldValue;
        VARIANT *vFieldValue;
        CString Holder;
        GetFieldValue(ColumnName, covFieldValue);
        vFieldValue = (LPVARIANT)covFieldValue;
        return Holder;


for some fields, this works fine. for others (possibly those
with a Memo type), it only returns the first character of
the string. i can get the full string with:

        Holder = vFieldValue->bstrVal;

but for the cases where the top code worked originally, that
returns garbage. i can't tell any difference in the two
VARIANTs that would allow me to differentiate betweent the
two cases, and documentationt that i can find suggests that
the value should always be in bstrVal if (vFieldValue.vt ==

thanks for any suggestions

Sun, 15 Sep 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. cdaorecordset::GetFieldValue --> variant

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

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

4. CDaoRecordset GetFieldValue

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

6. CDaoRecordset::GetFieldValue Error

7. Possible BUG in CDaoRecordset::GetFieldValue()

8. CDaoRecordset Variant to short

9. CDaoRecordSet -- CDaoRecordSet -- CDaoRecordSet

10. CDaoRecordset & Variants

11. CRecordset::GetFieldValue returns <space>

12. CRecordset::GetFieldValue returns <space>


Powered by phpBB® Forum Software