求助:在关键字select附近有语法错误
我在MFC里通过ADO调用数据库中的表Move,程序如下,但运行时却在程序的(*)处弹出“在关键字select附近有语法错误”的错误提示,但我将这个SQL语句复制到该表的查询里却能正常运行,不知道为什么这段代码放在MFC里却提示错误呢?
_ConnectionPtr m_pConnection;
::CoInitialize(NULL);
try
{
m_pConnection.CreateInstance( "ADODB.Connection ");
if (m_pConnection == NULL)
{
AfxMessageBox( "创建失败!\r\n ");
return -1;
}
ASSERT(m_pConnection != NULL);
_bstr_t strConnect= "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=car ";
m_pConnection-> Open(strConnect, " ", " ",adModeUnknown);
}
catch(_com_error e)
{
CString errormessage;
errormessage.Format( "连接数据库失败!\r\n错误信息:%s ",e.ErrorMessage());
AfxMessageBox(errormessage);
return -1;
}
m_pConnection-> Close();
::CoUninitialize();
m_adodc1.SetRecordSource( "SELECT move_id, longitude AS 经度, latitude AS 纬度 FROM Move "); ///////////////////////
m_adodc1.Refresh(); ///////////////////////(*)
return 0;
}
------解决方案--------------------???是不是你的别名有问题