Hello All,
I am facing some problem with CDBVariant. I am using CDBVariant variable (varValue) in my code to fetch some strings(of MEMO type) from a mdb file, using GetFieldValue(). When the application is built in "Release" mode in VS2008, the value returned by 'varValue' is truncated i.e. the last character of the string is truncated. If I build the same application in"Debug" mode, its returning the complete string without any problem.
Below mentioned is my code snippet:
strReadSqlAllLangString ="SELECT * FROM StringsTable";
nRetVal = rs_lang_all.Open ( CRecordset::forwardOnly, \
strReadSqlAllLangString, CRecordset::readOnly );
CDBVariant varValue;
nFields = rs_lang_all.GetODBCFieldCount( );
short nFieldType = DEFAULT_FIELD_TYPE;
int nTmp;
while ( !rs_lang_all.IsEOF() )
{
for(nIndex = 0; nIndex < nFields; nIndex++ )
{
rs_lang_all.GetFieldValue(nIndex, varValue);
if (varValue.m_dwType == 0)
{
strString3 = "";
}
else
{
strString3 = *varValue.m_pstring;
nTmp = strString3.GetLength();
}
arr_strAllLangStrings[nIndex][nLangStr] = strString3;
}
rs_lang_all.MoveNext();
nLangStr++;
}
I tried adding nFieldType = DEFAULT_FIELD_TYPE, but that also didnt work out. I dont know what is different in Debug mode & Release mode. In Debug mode-Its working & in Release mode- its not.
Please help me in fixing this. If anyone wants more info on this problem Or the entire code to refer, please let me know.
Thanks. Any kind of Help will be appreciated.
Best regards,
Dinesh