全文是这样的_bstr_t FixSQLString(BSTR bStr)
{
//转换成char
USES_CONVERSION;
string str(OLE2T(bStr)); string repStr("''"); //转换后的字符
string findStr("'"); //被转换的字符 int nPos = -1; //开始查找替换
do
{
nPos = str.find(findStr,nPos+1);
if (nPos != -1)
{
//开始替换
str.replace(nPos,1,repStr);
nPos++;
}
}while(nPos >= 0); return str.c_str();
}

解决方案 »

  1.   

    A2W,W2A等宏都是在Unicode和Ansi字符之间转换用的,在msdn上面有
    A2W(lpa)In the macro names, the source string type is on the left (for example, A) and the destination string type is on the right (for example, W). A stands for LPSTR, OLE stands for LPOLESTR, T stands for LPTSTR, and W stands for LPWSTR.Thus, A2W converts an LPSTR to an LPWSTR, OLE2T converts an LPOLESTR to an LPTSTR, and so on.W2A就是相反的转换而已
      

  2.   

    喝醉了,不好意思
    OLE2T 把一个LPOLESTR转化为LPTSTR字串
      

  3.   

    谢谢各位,谢谢将LPOLESTR转化为LPTSTR字串,有何作用呢