AsetofADOClasses-version2.10ByCarlosAntolliniOverviewTheCADODatabaseClassCADODatabaseOpenExecuteGetRecordsAffectedGetActiveConnectionGetRecordCountBeginTransactionCommitTransactionRollbackTransactionIsOpenCloseSetConnectionStringGetConnectionStringSetConnectionModeGetLastErrorGetLastErrorStringTheCADORecordsetClassCADORecordsetOpenExecuteGetQuerySetQueryRecordBindingGetRecordCountIsOpenCloseGetFieldCountGetFieldValueIsFieldNullIsFieldEmptyIsEofIsBofMoveAbsolutePageGetPageCountPageSizeAbsolutePositionGetFieldInfoGetChunkAppendChunkGetStringGetLastErrorGetLastErrorStringAddNewEditDeleteUpdateCancelUpdateSetFieldValueFindFindFirstFindNextGetBookmarkSetBookmarkSetFilterSetSortGetRecordsetGetActiveConnectionCloneSaveAsXMLOpenXMLTheCADOParameterClassCADOParameterSetPrecisionSetScaleSetValueGetValueSetNameGetNameGetTypeGetParemeterTheCADOCommandClassCADOCommandAddParameterSetTextGetTextSetTypeGetTypeGetCommandExecuteGetRecordsAffectedTheCJectEngineClassCompactDatabaseCommonQuestionsOverviewIcreatedtheseclassestomakeiteasytoworkwithado.ForthisIcreatedtheCADODatabseclassandtheCADORecordsetclassTheCADODatabaseClassTheCADODatabaseclasshasasetoffunctionsthatcorrespondstothe_ConnectionPtrCADODatabase::CADODatabaseCreatesaCADODatabaseobject.CADODatabase();CADODatabase::OpenTheOpenfunctionOpensaconnectiontoaDatabase.BOOLOpen(LPCTSTRlpstrConnection=_T());ParametersLPCTSTRlpstrConnectionTheconnectionstring.SeesampleNote:theclasshasthefunctionSetConnectionString.Youcaninserttheconnecctionstringthroughthisfunction.Inthiscaseyoucandothefollowing.//SamplewithConnectionstringforSQLServerCADODatabase*pAdoDb=newCADODatabase();CStringstrConnection=_T();strConnection=_T(Provider=MSDASQL;PersistSecurityInfo=False;Trusted_Connection=Yes;DataSource=AccessSqlServer;catalog=sampledb);pAdoDb-SetConnectionString(strConnection);if(pAdoDb-Open())DoSomething();...//SamplewithConnectionStringforAccessdatabaseCADODatabase*pAdoDb=newCADODatabase();CStringstrConnection=_T();strConnection=_T(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\\VCProjects\\ADO\\Test\\dbTest.mdb);pAdoDb-SetConnectionString(strConnection);if(pAdoDb-Open()){DoSomething();...pAdoDb-Close();}deletepAdoDb;CADODatabase::ExecuteTheExecutefunctionexecutesasqlstatementintheopendatabase.BOOLExecute(LPCTSTRlpstrExec)ParametersLPCTSTRlpstrExecAstringpointercontaininigthesqlstatementtoexecute.CADODatabase*pAdoDb=newCADODatabase();CStringstrConnection=_T();strConnection=_T(Provider=MSDASQL;PersistSecurityInfo=False;Trusted_Connection=YesDataSource=AccessSqlServer;catalog=sampledb);if(pAdoDb-Open(strConnection))pAdoDb-Execute(DeleteFromtblClientsWhereCheker=3);ReturnValueThefunctionreturnsTRUEifwassuccesfully.CADODatabase::GetRecordsAffectedTheGetRecordsAffctedfunctionreturnsthenumberofrecordsaffectedtothelastsqlstatementexecuted.intGetRecordsAffected();CADODatabase::GetActiveConnectionTheGetActiveConnectionreturnstheactiveconnection._ConnectionPtrGetActiveConnection();CADODatabase::GetRecordCountGetRecordCountreturnsthenumberofrecordsaffectedinaquery.DWORDGetRecordCount(_RecordsetPtrm_pRs);Parameters_RecorsetPtrm_PrsTherecordset.CADODatabase::BeginTransactionCallthisfunctiontoinitiateatransaction.AfteryoucallBeginTransaction,updatesyoumaketoyourdatatakeeffectwhenyoucommitthetransaction.longBeginTransaction();CADODatabase::CommitTransactionCallCommitTransactionfunctiontocommitatransactionforexamplesaveagroupofeditsandupdatestooneormoredatabases.longCommitTransaction();CADODatabase::RollbackTransactionCallRollbackTransactionfunctiontoendthecurrenttransactionandrestorealldatabasestotheirconditionbeforethetransactionwasbegun.longRollbackTransaction();CADODatabase::IsOpenTheIsOpenfuntionreturnsthestatusoftheconnectionwiththedatabase.BOOLIsOpen();ReturnValueThefunctionreturnsTRUEiftheconnectiontodatabaseisopen.CADODatabase::CloseTheClosefunctionclosetheconnectiontothedatabase.voidClose();CADODatabase::SetConnectionStringWiththeSetConnectionStringYoucaninserttheconnectionstring.voidSetConnectionString(LPCTSTRlpstrConnection);ParametersLPCTSTRlpstrConnectionAconnectionstringusedforopeningthedatabase.seeCADODatabase::Open()CADODatabase::GetConnectionStringTheGetConnectionStringfunctionreturnstheconnectionstringusedformakeaconnectionwithadatabase.CStringGetConnectionString();CADODatabase::SetConnectionModeTheSetConnectionModefunctionsetsthemodeofconnection.voidSetConnectionMode(cadoConnectModeEnumnMode);ParameterscadoConnectModeEnumnModeavariablethatdefinestheconnectionmodetobeused.Itcanbeoneofthefollowing:CADODatabase::connectModeUnknownCADODatabase::connectModeReadCADODatabase::connectModeWriteCADODatabase::connectModeReadWriteCADODatabase::connectModeShareDenyReadCADODatabase::connectModeShareDenyWriteCADODatabase::connectModeShareExclusiveCADODatabase::connectModeShareDenyNoneCADODatabase::GetLastErrorTheGetLastErrorfunctionreturnsthelasterrorcode.DWORDGetLastError();CADODatabase::GetLastErrorString