Error using ExcelDna + System.Data.Odbc .NET6

234 views
Skip to first unread message

Carlos Javier

unread,
Sep 2, 2022, 11:39:06 PM9/2/22
to Excel-DNA
Good to everyone,

I have the following problem
Windows 10, Visual Studio 2022, .NET6

I have created a first test to connect to a sqlite database using System.Data.Odbc 6.0.0.0 as .EXE application, and it connects correctly.

        private void btnConnectP6_Click(object sender, EventArgs e)
        {
            using (var odbcConnection = new OdbcConnection("DSN=DB_TEST1_P6"))
            {
                odbcConnection.Open();   // open the connection
                                         // prepare the message
                string message = "Connection Successful!"
                          + Environment.NewLine
                          + "DSN: " + odbcConnection.ConnectionString
                          + Environment.NewLine
                          + "Driver: " + odbcConnection.Driver;
                // show the result
                MessageBox.Show(message,
                                "Test Connection",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);


                odbcConnection.Close();  // close the connection
            }
        }


App connect.jpg
2. Then I have created a Ribbon with ExcelDna (Class Library), and I have tried to connect to the same sqlite database using System.Data.Odbc. But this time it doesn't allow me anymore, I get the following error message. "System.Data.ODBC is not supported on this platform".


2 odbc.jpg

In the first example when I connect to the sqlite database using odbc from an application I have no problem.

Then I try to connect to the same database with the same code that worked before, but this time from a Class Library, using ExcelDNA, the Odbc doesn't seem to work, can anyone help me to solve this problem.

I look forward to your comments, thank you

Carlos P.


Alexander L

unread,
Mar 30, 2023, 3:55:36 PM3/30/23
to Excel-DNA
Hello. Got today a similar problem. Is any solution known?

Govert van Drimmelen

unread,
Mar 30, 2023, 3:58:48 PM3/30/23
to exce...@googlegroups.com

Hi Alexander,

 

This should work better in the current Excel-DNA prereleases, where we addressed some of the runtime dependency resolution.

I suggest you try the latest version 1.7.0-rc2.

 

-Govert

2. Then I have created a Ribbon with ExcelDna (Class Library), and I have tried to connect to the same sqlite database using System.Data.Odbc. But this time it doesn't allow me anymore, I get the following error message. "System.Data.ODBC is not supported on this platform".

 

 

 

In the first example when I connect to the sqlite database using odbc from an application I have no problem.

Then I try to connect to the same database with the same code that worked before, but this time from a Class Library, using ExcelDNA, the Odbc doesn't seem to work, can anyone help me to solve this problem.

 

I look forward to your comments, thank you

 

Carlos P.

 

 

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/b71d0e18-81ed-459e-9ebf-40cce950bbean%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages