FW: Problem using Unicode

From: Magda Danish (Unicode) (v-magdad@microsoft.com)
Date: Thu Aug 02 2001 - 13:58:52 EDT


-----Original Message-----
From: Alekov, Trifon [mailto:trifon.alekov@barco.com]
Sent: Thursday, August 02, 2001 2:18 AM
To: 'info@unicode.org'
Subject: Problem using Unicode

Dear Sirs,
I have the following problem.
My VC6++ project reads the data from the Access and Excel db connected
trough the ODBC. To read the data I use MFC classes CRecordset and
CDBVariant. But when I have a Cyrillic,Greek,Arabic etc text in my db
the result after reading is ??????

My project is set for Unicode(I have _UNICODE and wWinMainCRTStartup in
my settings). I

This is a part of my code:
                
                        CString str;
                        CRecordset* m_pSet;
                        .
                        .
                        .
                        CDBVariant var;
                        m_pSet->GetFieldValue(ib,var);
                          switch (var.m_dwType)
                          {
                                  case DBVT_STRING:
                                        str = *var.m_pstring; // narrow
characters
                                        break;
                                  case DBVT_SHORT:
        
str.Format(_T("%d"),(int)var.m_iVal);
                                        break;
                                  case DBVT_LONG:
                                        str.Format(_T("%d"),var.m_lVal);
                                        break;
                                  case DBVT_SINGLE:
        
str.Format(_T("%10.2f"),(double)var.m_fltVal);
                                        break;
                                  case DBVT_DOUBLE:
        
str.Format(_T("%d"),(int)var.m_dblVal);
                                        break;
                                  case DBVT_DATE:
        
str.Format(_T("%02d.%02d.%04d"),var.m_pdate->day,var.m_pdate->month,var.
m_pd
ate->year);
                                        break;
                                  case DBVT_BOOL:
                                        str = (var.m_boolVal ==
0)?_T("FALSE") : _T("TRUE");
                                        break;
                                  case DBVT_NULL:
                                        str = _T("");
                                        break;
                                  default:
                                        str.Format(_T("Unk
type%d\n"),var.m_dwType);
                        }

Have you any idea what is wrong with my program and how can I read
Unicode data from the db via ODBC? Kind regards,

Trifon Alekov



This archive was generated by hypermail 2.1.2 : Thu Aug 02 2001 - 15:26:48 EDT