How can I suppress c4996 warning caused by using obsolete ODBC API methods

Full warning:

warning C4996: "SQLSetConnectOption": ODBC API: SQLSetConnectOption deprecated. Use SQLSetConnectAttr instead.

+3
source share
1 answer

The quick answer is to use the #pragma warning (disable: 4996) around the SQLConnectOption call:

#pragma warning(push)
#pragma warning(disable: 4996)

rc = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);

#pragma warning(pop)

A more sophisticated approach is to replace calls with SQLSetConnectOptionequivalent calls on SQLSetConnectAttr.

msdn ( MSDN SQLSetConnectOption), , . ; , 4- (StringLength) SQL_NTS, , 0, , , .

+2

All Articles