#include <afx.h>
#include <iostream>
#import "C:Program FilesCommon FilesSystemADOmsado15.dll" no_namespace rename("EOF"??"adoEOF")
using namespace std;
#define BUFSIZE 64
int main()
{
//char buf[BUFSIZE];
//int index;
_ConnectionPtr m_pConnection;
CoInitialize(NULL);//?????COM???
HRESULT hr=m_pConnection.CreateInstance(__uuidof(Connection));
if(SUCCEEDED(hr))
{
cout<<"????Connection????????"<<endl;
}
try
{
_bstr_t strConnect="Provider=OraOLEDB.Oracle;User ID=scott;Password=19900624;Persist Security Info=True;Data Source="(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.108.85.137)(PORT = 1521)) )(CONNECT_DATA = (SID = ORCL)(SERVER=DEDICATED)))"";
hr=m_pConnection->Open(strConnect??""??""??NULL);
if(SUCCEEDED(hr))
cout<<"????????????"<<endl;
}
catch(_com_error e) //?????
{
cout<<e.ErrorMessage()<<e.Description()<<endl;
//cout<<"error"<<endl;
return FALSE;
}
/////////////////???????????//////////////////////
_variant_t var1;
_RecordsetPtr m_pRecordset=NULL;  //???????????????????
m_pRecordset.CreateInstance(__uuidof(Recordset));//?????Recordset???
char *content;
char type;
cin>>type;
switch(type)
{
case 's':
try
{
CString sql;
sql="select * from DB_USER";
m_pRecordset=m_pConnection->Execute((_bstr_t)sql??NULL??adCmdText);
}
catch(_com_error *e)
{
cout<<e->ErrorMessage()<<endl;
}