繁体   English   中英

sqlite3中的c#System.MissingMethodException

[英]c# System.MissingMethodException in sqlite3

我正在制作使用sqlite3数据库的ac#应用程序。 对于sqlite,我正在使用System.Data.SQLite.dll 问题是在某些系统上程序可以正常运行,但在其他系统上,读取数据库时会引发System.MissingMethodException

这是我用来阅读的代码:

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();
    }
}

这是我得到的错误:

在此处输入图片说明

您能告诉我是什么导致此异常吗? 以及如何避免呢?

检查是否

  1. 所有计算机上的System.Data.SQLite.dll版本相同

  2. 这些计算机上安装的.NET Framework版本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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