Full warning message is:
warning C4996: 'SQLSetConnectOption': ODBC API: SQLSetConnectOption is deprecated. Please use SQLSetConnectAttr instead.
The quick answer is to use #pragma warning(disable: 4996) around the call to SQLConnectOption:
#pragma warning(push)
#pragma warning(disable: 4996)
rc = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
#pragma warning(pop)
A more involved approach is to replace your calls to SQLSetConnectOption with equivalent calls to SQLSetConnectAttr.
There is a fairly detailed msdn article here (MSDN Article on SQLSetConnectOption Mapping) that explains how to convert the function call. In most cases it appears fairly trivial; the first three arguments are identical, and the new 4th argument (StringLength) is either SQL_NTS if the value parameter is a string, 0 if it is an integer, or a length value if it is a driver-defined paramter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With