|
evc中rda编pull出现的问题(请大家多多帮忙啊!!!)
[复制链接]
近日学习Pda上数据库编程,在evc4.0中使用RDA 编写了一个PDA的sqlce从sqlserver2000上数据库(dbtest)pull一个表(id)的小程序,iis设置好了,在pda上能ie到http://192.168.0.119/sqlce/sscesa20.dll,pull中的各个参数也都按书本及对照网上一些说明设好,可是总是不能pull到表,调试时运行完hr = pCERDA->Pull(.....);后hr = -2147418113请问可能是什么地方出了问题啊?这个问题困扰了我多日,问了几个地方了,希望有人能帮助我,谢谢!
我的小程序如下:
void CRDAtestDlg::OnBtnpull()
{
ISSCERDA* pCERDA = NULL;
BSTR bStr = NULL;
BSTR bConnectStr = NULL;
BSTR bQueryStr = NULL;
BSTR bLocalConnectStr = NULL;
BSTR bLocalTableName = NULL;
BSTR bErrorTableName = NULL;
RDA_TRACKOPTION trackOption = TRACKINGON;
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED );
hr = CoCreateInstance(CLSID_RemoteDataAccess, NULL, CLSCTX_INPROC_SERVER, IID_ISSCERDA, (LPVOID *)&pCERDA);
if(hr == S_OK )
{
AfxMessageBox(_T("成功111!"));
}
bStr = SysAllocString(_T("http://192.168.0.119/sqlce/sscesa20.dll"));
hr = pCERDA->put_InternetURL(bStr);
SysFreeString(bStr);
bStr = SysAllocString(_T(""));
hr = pCERDA->put_InternetLogin(bStr);
SysFreeString(bStr);
bStr = SysAllocString(_T(""));
hr = pCERDA->put_InternetPassword(bStr);
SysFreeString(bStr);
bErrorTableName = SysAllocString(_T("idErrors"));
bConnectStr = SysAllocString(_T("provider=sqloledb; data source=192.168.0.119; Initial Catalog=dbtest; user id=sum; password=123"));
bLocalConnectStr = SysAllocString(_T("Provider=microsoft.sqlserver.oledb.ce.2.0; Data Source=\\My Documents\\dbtest.sdf"));
bLocalTableName = SysAllocString(_T("id"));
bQueryStr = SysAllocString(_T("SELECT Id FROM id")); //Id为id表中唯一的项设为了主键
hr = pCERDA->Pull(bLocalTableName,
bQueryStr,
bConnectStr,
trackOption,
bErrorTableName);
SysFreeString(bLocalTableName);
SysFreeString(bQueryStr);
SysFreeString(bConnectStr);
SysFreeString(bErrorTableName);
if (hr == S_OK)
{
AfxMessageBox(_T("成功!!"));
}
else
{
AfxMessageBox(_T("失败!!"));
}
pCERDA->Release();
}
iis 设了anonymous access
sql server 身份验证选了sql server和windows
|
|