Resolved C# The specifIed dSn contains an architecture mismatch between the driver and application.

I developed an application using the .NET Framework version 3.5. And I executed on a 64-bit version of Windows 10. This error occurs when App accesses a database using a 32-bit ODBC Driver.

This is because that application executes on 64-bit architecture but ODBC Driver is the 32-bit version.

  • Application: 64-bit
  • Operating System: Windows 10 64-bit
  • ODBC Driver: 32-bit Version

You should choose the same architecture (32 or 64-bit). I have chosen 32-bit application and ODBC Driver.

In the project properties of your project, you can choose a platform target at the "Build" page. Choose Platform target between these options.

  • Any CPU means that the Operating System appropriately changes 32-bit or 64-bit.
  • x86 means that the application will be executed on 32-bit.
  • x64 means that the application will be executed on 64-bit.

FYI: I expose source code that returns application architecture of the execution app.

    /// <summary>
    /// 実行時のアーキテクチャが32Bitか64Bitかを判断する
    /// </summary>
    /// <param name="processBit"></param>
    /// <returns></returns>
    public static int GetRunningArch(out string processBit)
    {
        processBit = "";

        try
        {
            if (IntPtr.Size == 4) processBit = "32bit";
            else processBit = "64bit";

            return 0;
        }
        catch
        {
            return 16;
        }

    }

\ シ ェ ア お ね が い し ま す ! ! /

目次