ODBC有类似 jdbc的ResultSet类来封装查询到的数据吗?
我现在用ODBC,实现C++连接SQL server2008,想输出查询结果,但是不知道用什么接口!
本人菜鸟级水平,还望大牛们耐心调教!小弟在此白拜谢了!
------解决方案--------------------
c++连sql直接连不就好了???
- C/C++ code
//stdafx.h#import "C:\Program Files\Common Files\System\ADO\msado15.dll"\ no_namespace rename("EOF","sqlEOF")#include <icrsint.h>//应用程序InitInstance方法中加入::CoInitialize(NULL);//声明public: _ConnectionPtr m_pConnection; _RecordsetPtr m_pRecordset; _CommandPtr m_pCommand;//调用m_pConnection.CreateInstance(__uuidof(Connection)); m_pRecordset.CreateInstance(__uuidof(Recordset)); m_pCommand.CreateInstance(__uuidof(Command)); m_pConnection->ConnectionString="Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=test;User ID=sa;Password=123456"; m_pConnection->ConnectionTimeout=60; HRESULT hr=m_pConnection->Open("","","",0); if(hr!=S_OK) MessageBox(_T("Can not connection to database")); MessageBox(_T("success!")); m_pConnection->Close();