修改后的代码:哎!这个问题搞了我一晚上。void CSpreadSheet::GetExcelDriver()
{ wchar_t szBuf[2001];
WORD cbBufMax = 2000;
WORD cbBufOut;
//char *pszBuf = szBuf;
wchar_t *pszBuf = szBuf;
// Get the names of the installed drivers ("odbcinst.h" has to be included )
if(!SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut))
{
m_sExcelDriver = "";
} // Search for the driver...
do
{
if( wcsstr( pszBuf, L"Excel" ) != 0 )
{
// Found !
m_sExcelDriver = CString( pszBuf );
break;
}
wchar_t ze = {'\0'};
pszBuf = wcschr( pszBuf, ze ) + 1;
}
while( pszBuf[1] != '\0' );
}参考:http://topic.csdn.net/u/20100529/00/6899e418-a6f8-4e2b-8660-6d6d4ba3cabc.html?seed=1409856188&r=73511976#r_73511976
{ wchar_t szBuf[2001];
WORD cbBufMax = 2000;
WORD cbBufOut;
//char *pszBuf = szBuf;
wchar_t *pszBuf = szBuf;
// Get the names of the installed drivers ("odbcinst.h" has to be included )
if(!SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut))
{
m_sExcelDriver = "";
} // Search for the driver...
do
{
if( wcsstr( pszBuf, L"Excel" ) != 0 )
{
// Found !
m_sExcelDriver = CString( pszBuf );
break;
}
wchar_t ze = {'\0'};
pszBuf = wcschr( pszBuf, ze ) + 1;
}
while( pszBuf[1] != '\0' );
}参考:http://topic.csdn.net/u/20100529/00/6899e418-a6f8-4e2b-8660-6d6d4ba3cabc.html?seed=1409856188&r=73511976#r_73511976
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货