|
-
July 24th, 2003, 05:53 PM
#1
Problem: Saving COleVariant fields in CDaoRecordset
HI,
I am having a problem saving, retrieving and searching on fields in my dao recordset (Access database). I am saving a number of text fields into a table in the following manner:
Code:
m_pRecordset->SetFieldValue(m_Fields[i].cFieldName, cElements[i]);
Where cElements is an array of COleVariants ... each one being converted from a CString in the following way:
Code:
CString field1("test");
varArray[0] = COleVariant(field1);
The fields are all added fine, but when I open the database in Access they appear only as one character. eg: For the 'test' example, the field appears as 't' only. When I retrieve the strings from the database using the following code:
Code:
m_pRecordset->GetFieldValue(cFieldName, temp);
CString field1 = (CString)temp.bstrVal;
I get the full field value of 'test'. So - this is seems alright, although I could not work out why only the one character is seen in Access.
When I go to search on the field however, I run into problems. I can never find the record whose key value = 'test' because it appears to be comparing it to 't' rather than the full string.
Is this clear? Can anyone help with this issue?
thanks,
Em
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|