
If (SQL_SUCCESS != SQLSetEnvAttr(sqlEnvHandle, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0)) If (SQL_SUCCESS != SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &sqlEnvHandle)) I'm not sure if there is an easier way to connect to a server, but any tips would be much appreciated.

I borrowed this code from and had to add a typedef INT64 SQLLEN and change SQLINTEGER to SQLLEN to get it to run. \sqlexpress and the database should be GRDb, but I also tried different server names and "master" for DATABASE.

I've tried multiple different connection strings to find the server, but they all have the same result. I'm trying to connect to a local SQL express server using C++ in Microsoft Visual Studio 22, but I keep getting a "Could not connect to SQL Server" issue and I'm not sure what's wrong.
