eg:
rs.Open( CRecordset::dynaset, _T( "Select L_Name from Customer" ) );

解决方案 »

  1.   

    _T宏
    可以将字符编译成unicode或是ansi,主要看你的预处理
      

  2.   

    Using Generic-Text Mappings
    Microsoft Specific —>To simplify code development for various international ets, the Microsoft run-time library provides Microsoft-specific “generic-text” mappings for many data types, routines, and other objects. These mappings are defined in TCHAR.H. You can use these name mappings to write generic code that can be compiled for any of the three kinds of character sets: ASCII (SBCS), MBCS, or Unicode, depending on a manifest constant you define using a #define statement. Generic-text mappings are Microsoft extensions that are not ANSI compatible.Preprocessor Directives for Generic-Text Mappings#define Compiled Version Example  
    _UNICODE Unicode (wide-character) _tcsrev maps to _wcsrev 
    _MBCS Multibyte-character _tcsrev maps to _mbsrev 
    None (the default: neither _UNICODE nor _MBCS defined) SBCS (ASCII) _tcsrev maps to strrev 
    For example, the generic-text function _tcsrev, defined in TCHAR.H, maps to mbsrev if MBCS has been defined in your program, or to _wcsrev if _UNICODE has been defined. Otherwise _tcsrev maps to strrev. The generic-text data type _TCHAR, also defined in TCHAR.H, maps to type char if _MBCS is defined, to type wchar_t if _UNICODE is defined, and to type char if neither constant is defined. Other data type mappings are provided in TCHAR.H for programming convenience, but _TCHAR is the type that is most useful. Generic-Text Data Type MappingsGeneric-Text Data Type Name SBCS (_UNICODE, _MBCS Not Defined) 
    _MBCS Defined 
    _UNICODE Defined 
    _TCHAR char char wchar_t 
    _TINT int int wint_t 
    _TSCHAR signed char signed char wchar_t 
    _TUCHAR unsigned char unsigned char wchar_t 
    _TXCHAR char unsigned char wchar_t 
    _T or _TEXT No effect (removed by preprocessor) No effect (removed by preprocessor) L (converts following character or string to its Unicode counterpart) 
    For a complete list of generic-text mappings of routines, variables, and other objects, see Appendix B, Generic-Text Mappings.The following code fragments illustrate the use of _TCHAR and _tcsrev for mapping to the MBCS, Unicode, and SBCS models._TCHAR *RetVal, *szString;
    RetVal = _tcsrev(szString);If MBCS has been defined, the preprocessor maps the preceding fragment to the following code:char *RetVal, *szString;
    RetVal = _mbsrev(szString);If _UNICODE has been defined, the preprocessor maps the same fragment to the following code:wchar_t *RetVal, *szString;
    RetVal = _wcsrev(szString);If neither _MBCS nor _UNICODE has been defined, the preprocessor maps the fragment to single-byte ASCII code, as follows:char *RetVal, *szString;
    RetVal = strrev(szString);Thus you can write, maintain, and compile a single source code file to run with routines that are specific to any of the three kinds of character sets. 
      

  3.   

    这是来自MSDN帮助文件的说明,可以说就权威的了!
      

  4.   

    _T宏
    可以将字符编译成unicode或是ansi,主要看你的预编译的宏的设置
      

  5.   

    _T宏
    可以将字符编译成unicode或是ansi,主要看你的预编译的宏的设置
    /* Generic text macros to be used with string literals and character constants.
       Will also allow symbolic constants that resolve to same. */
    #define __T(x)      L ## x
    #define _T(x)       __T(x)
    #define _TEXT(x)    __T(x)
      

  6.   

    _T宏一般做一般的Windows程序是不需要的,我碰到的就是在做COM和嵌入式操作系统WinCE时需要用到_T。假如你要生成Unicode文本文件,则也需要_T宏。_T宏定义的字符串每个字符占用2个字节,不管是中文/英文/数字/字符都一样。我知道的就这么多了,希望对搂住有所帮助。
      

  7.   

    _T宏
    可以将字符编译成unicode
      

  8.   

    CString aa;
    _T(aa);Windows使用两种字符集ANSI和UNICODE,前者就是通常使用的单字节方式,但这种方式处理象中文这样的双字节字符不方便,容易出现半个汉字的情况。而后者是双字节方式,方便处理双字节字符。Windows NT的所有与字符有关的函数都提供两种方式的版本,而Windows 9x只支持ANSI方式。_T一般同字常数相关,如_T("Hello")。如果你编译一个程序为ANSI方式,_T实际不起任何作用。而如果编译一个程序为UNICODE方式,则编译器会把"Hello"字符串以UNICODE方式保存。_T和_L的区别在于,_L不管你是以什么方式编译,一律以以UNICODE方式保存