简体   繁体   中英

c# System.MissingMethodException in sqlite3

I'm making ac# application which uses sqlite3 database. For sqlite, I'm using System.Data.SQLite.dll . The problem is on some systems the program works fine, but on others, it throws System.MissingMethodException while reading the database.

This is the code I'm using for reading :

using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection("data source=" + file_name))
{
    using (System.Data.SQLite.SQLiteCommand com = new System.Data.SQLite.SQLiteCommand(con))
    {
        con.Open();
        com.CommandText = "Select * FROM my_table;";

        using (System.Data.SQLite.SQLiteDataReader reader = com.ExecuteReader())
        {
            while (reader.Read())
            {
                Console.WriteLine(reader["field1"] + " : " + reader["field2"] +" : " + reader["field3"]);

                if(reader["field1"].ToString().Equals("1"))
                {
                    xlWorkSheetR1.Cells[i, 2] = reader["field1"];
                    xlWorkSheetR1.Cells[i, 3] = reader["field2"];
                    i++;
                }
            }
        }
        con.Close();
    }
}

And this is the error I'm getting :

在此处输入图片说明

Can you please tell me what is causing this exception ? And how to avoid it ?

Check if

  1. Version of System.Data.SQLite.dll is same across all machines

  2. Version of .NET frameworks installed on these machines

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM