This sample really doing very good job in my development case. But, I am struggling with transaction. I want to rollback the changes using RollBack() method, But, I couldn't.
I appreciate your quick response in this regards.
Thanks in advance
I have been trying to connect the Access Data Base using ODBC in VC 6.0. My application is an Dialog based and when i started i had no thought of any data base.Now i need to connect to one. I have tried all means with no success.The program runs but when the dialog box is invoked it posts a message saying either it is not compatable or not able to find an DSN name. The DSN name is already given.How can do this connectivity.
I think that there is an error in your code. It occurs in a situation when we try to close odbc connection and open it again - database and environmaent handles will become invalid. So i've moved handles allocation code into SQLConnect method and everything works fine now (or at least seems to work fine).
Thanks so much for posting your solution. I am writing a very similar DB application for a course I am taking. I am searching a table which is a list phone calls. Each phone call has a date associated with it. How would I construct a "SetWhere" statement to return all the calls in a given date range? For example, to return a list of all calls that occurred in month '06'...?
thanks a lot for your wrapper classes: exactly what i was looking for!
i tried anyway to compile it with different compilers, and only VC++ has accepted your code "as-is": for the other i had to change some details... but i think that was compiler problems.
anyway i tried as far only with ms access.
i ve got a question: why should the option "ImplicitCommitSync" turned on? i tried to let it turned off, and added following code in order to use the datbase over transactions commit/rollback:
void CSQLDatabase::SetAutoCommit( bool tf ) // makes all transactions COMMIT immediately
_autoCommit = tf;
// added: desactivate the autocommit-mode in order to start a new transaction after each commit/rollback
_rc = ::SQLSetConnectAttr( _hdbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0);
if ( !( _rc == SQL_SUCCESS || _rc == SQL_SUCCESS_WITH_INFO ) )
for now, call SetAutoCommit(false) only work before any recordset has been opened, but it might be odbc-driver dependant. Otherwise i get an error "setting this option is not possible at this time".
If you want to apply these modifications to your new uploaded code, feel free!