|
| I'm using VC6+SP5, WinXP+SP2. I wrote a program based on CDatabase and
CRecordset, but it's not generated by the ClassWizard. The old version
compiled on Feb. 2004 can open and read 'nchar', 'nvarchar' fields in MS SQL
Server 7.0 database, these fields are converted to ANSI and bound to CString
automatically.
But now when I compile the program again, the UNICODE 'nchar', 'nvarchar'
fields can't be converted to ANSI automatically, so the field type SQL_WCHAR
and SQL_WVARCHAR can't be recognized in the MFC function:
CRecordset::GetDefau
ltFieldType(short nSQLType)
and make ASSERT failure messages.
After reading a lot of documents, it seems the driver manager thinks my
program is a "UNICODE aware" application, and thus the conversion from
UNICODE to ANSI is not taken. But CRecordset and CDatabase in MFC4.x can't
deal with UNICODE, this causes the program fails.
But the old version of my program can read those fileds correctly! It's so
strange, I don't know why, is there any option in the compiler or the
system? I'm sure my new version don't have '_UNICODE' defined, and there is
no IMPORT function called with a 'W' sufix. The source code of the old
version is lost. What can I do?
|
|