首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

大家帮小弟我看上这个代码有什么有关问题,为什么老是找不到那个table

2012-08-16 
大家帮我看下这个代码有什么问题,为什么老是找不到那个table啊#include stdafx.h#include Windows.h#i

大家帮我看下这个代码有什么问题,为什么老是找不到那个table啊
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#include <stdlib.h>

using std::cout;
using std::endl;

int main()
{
::CoInitialize(NULL);
HRESULT hr = NULL;
_ConnectionPtr pConnection = NULL;
hr = pConnection.CreateInstance(_uuidof(Connection));

if (FAILED(hr))
{
return 0;
}

//_bstr_t strConn = "Driver={PostgreSQL ANSI};server='192.168.1.61';uid=postgres;pwd=123456;database=DM";
_bstr_t strConn = "Provider=MSDASQL.1;Password=123456; Persist Security Info=False;User ID=postgres;Data Source=DM; Server=192.168.1.61";

try
{
pConnection->Open(strConn,"","",NULL);
}
catch (_com_error e)
{
cout << "Error:" << e.Description() << endl;
}

_RecordsetPtr pRecordset;

if (FAILED(pRecordset.CreateInstance(_uuidof(Recordset))))
{
return 0;
}

try
{
pRecordset->Open(_variant_t("tbl_devices"),_variant_t((IDispatch *)pConnection),adOpenKeyset,adLockOptimistic,adCmdTable);
}
catch (_com_error e)
{
cout << "Error:" << e.Description() << endl;
}

_bstr_t strsql = "select * from tbl_devs where use_id='1'";
pRecordset = pConnection->Execute(_bstr_t(strsql),NULL,adCmdText);


while (!pRecordset->adoEOF)
{
cout << "aa" << endl;
}


return 0;
}
高手帮忙看一下啊

[解决办法]
问题说清楚些
[解决办法]
楼主把问题说清楚呢。或者自己加断点调试吧

热点排行