_connectionptr pconn;//connection to the image
_RecordsetPtr prect;//Record Set object
_commandptr pcmd;//Command Object
Prect.createinstance (__uuidof (Recordset));
Pconn.createinstance (__uuidof (Connection));//l connection to the image
Pcmd.createinstance (__uuidof command);//Commands Object
_bstr_t strconn = "PROVIDER=ORAOLEDB.ORACLE.1; User id=%s; Password=%s;data source= (description= (address= (protocol=tcp) (host=%s)) (port=%s (connect_data= =%s)) ); Persist Security Info=false "; This is a remote
strconn = "PROVIDER=ORAOLEDB.ORACLE.1; Persist Security info=true;database=%s; User id=%s; Password=%s; "; This is a local
HRESULT RValue = Pconn->open (strconn, "", "", adModeUnknown);
if (RValue = = S_FALSE) {return; }
CString str = "SELECT * from Cc_bank";
Prect = Pconn->execute (_bstr_t (str), null,adcmdtext);
Prect->movefirst ();
while (Prect->adoeof==variant_false)
{
CString str = LPSTR (_bstr_t (Prect->getcollect ("Cnname"));
MessageBox (str);
Prect->movenext ();
}
Prect->close ();
Pconn->close ();
Prect.release ();
Pconn.release ();
Pcmd.release ();
}
catch (_com_error &e)
{
MessageBox (E.errormessage ());
}