Sql Native: Client 10.1

// Connection string SQLWCHAR connStr[] = L"Driver=SQL Server Native Client 10.0;" L"Server=localhost;Database=master;Trusted_Connection=yes;"; ret = SQLDriverConnectW(hdbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);

Driver=SQL Server Native Client 10.0;Server=myServer\instance;Database=myDB;Trusted_Connection=yes; sql native client 10.1

SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0); SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); ret = SQLDriverConnectW(hdbc

// Set connection properties (simplified) DBPROP InitProps[2]; // ... set server, db, auth ... Driver=SQL Server Native Client 10.0

Driver=SQL Server Native Client 10.0;Server=myServer;Database=myDB;Uid=myUser;Pwd=myPass;

Provider=SQLNCLI10;Server=tcp:myServer,1433;Database=myDB;Trusted_Connection=yes;

hr = pDBC->Initialize(); // use connection... pDBC->Release(); CoUninitialize(); return 0; #include <windows.h> #include <sql.h> #include <sqlext.h> #include <iostream> int main() SQLHENV henv; SQLHDBC hdbc; SQLRETURN ret;