|
服务器上用的是sql server 2000,想试着连接一下,用了下面的代码,vs 2005,c++语言
ISSCERDA *pCERDA = NULL;
HRESULT hr = CoCreateInstance(CLSID_RemoteDataAccess,NULL,CLSCTX_INPROC_SERVER,IID_ISSCERDA,(LPVOID *)&pCERDA);
pCERDA->put_InternetURL(SysAllocString(_T("http://192.168.0.108/sqlce/sqlcesa30.dll")));
pCERDA->put_InternetLogin(SysAllocString(_T("sinceres")));
pCERDA->put_InternetPassword(SysAllocString(_T("soft")));
BSTR bstrCon = SysAllocString(_T("Provider = sqloledb.1;Data Source = 192.168.0.108;Initial Catalog = TestDataBase;user id = sina;password = ftp"));
BSTR bstrQuery = SysAllocString(_T("Update tyKanban"));
hr = pCERDA->SubmitSQL(bstrQuery,bstrCon);
if(SUCCEEDED(hr))
{
AfxMessageBox(_T("OK"));
}
else
{
AfxMessageBox(_T("ERROR"));
}
运行后什么反应都没有,设置断点跟踪发现第三行pCERDA->put_InternetURL(SysAllocString(_T("http://192.168.0.108/sqlce/sqlcesa30.dll")));后的语句都未执行,直接跳出来了,不明白是为什么,请大家帮忙解答一下,谢谢
|
|