Custom program cannot connect to Sage 50 after upgrade from v25 to v26

SOLVED

Hi all,

I have a customer that have been using Sage 50 and my custom program for few years and its working perfectly. Until recently the customer upgrade from v25 to v26, now my custom program is not working because of connection problem. The error as below:

ERROR [01000] The driver returned invalid (or failed to return) SQL_DRIVER_ODBC_VER: 26.3
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
   at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
   at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
   at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.Odbc.OdbcConnection.Open()

I also notice the version of the driver have changed for v26

In my custom program, I am making a simple connection as below. I am using OdbcConnection class

connetionString = "DSN=" + DBNAME + "; UID=" + usname.Text + "; PWD=" + pwd.Password.ToString() + "";
            
conn = new OdbcConnection(connetionString);
try
{
    conn.Open();
    conn.Close();
}catch (Exception e)
{
    return false;
}

Anyone can help me solve this problem? I have try build my custom program is 2 versions: 32 bit and 64bit, but both have the same error.

Edit: Sage 50 is upgraded via a product update. After product update, the version is newer version

Top Replies