News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Am I connected to an ODBC source?

Started by Lightman, February 19, 2016, 10:52:49 PM

Previous topic - Next topic

Lightman

Hi Everyone,

I'm working with some code that connects to an ODBC source. My code can connect correctly to the database and I can run a basic SQL query. I'm wanting to tidy up my code and add some proper error-checking, which leads to an interesting question...

How do I know if I am connected to an ODBC source? Now, I am assuming that I need only call the ODBC connection routine once when my application is running and that, once opened, the connection will stay open until I close it. When I call for an ODBC connection, I pass in a connection handle but this appears to be empty even after a successful connection. I'm a bit confused by this, do I not need a handle for future statements? Or do I need to open a connection for each SQL statement I want to run?

Regards,

Lightman