我試圖讓SQLite運行在C#的Visual Studio 2012中。 但是,經過一組教程後,我仍然得到SQLite.Interop.dll錯誤DllNotFoundException。DllNotFoundException for SQLite.Interop.dll(C#&SQLite)
這是完全錯誤我收到:
無法加載DLL 'SQLite.Interop.dll':指定的路徑 無效。 (異常來自HRESULT:0x800700A1)
我已經創建了System.Data.SQLite.dll的引用。現在我發現我必須將SQLite.Interop.dll文件添加到我的項目文件夾中,但仍然出現此錯誤。
哦,順便說一句,這是我的代碼,如果有人有興趣:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;
namespace SQLiteWinFormCS
{
public partial class Form1 : Form
{
private SQLiteConnection _sqlCon;
private SQLiteCommand _sqlCmd;
private SQLiteDataAdapter _db;
private DataSet _ds = new DataSet();
private DataTable _dt = new DataTable();
private string _dbPath = String.Empty;
public Form1()
{
InitializeComponent();
}
private void uiOpenDB_Click(object sender, EventArgs e)
{
Console(String.Format("You clicked {0}.", ((Button)sender).Name));
this._dbPath = uiDatabaseFilepath.Text;
Console("Filepath to DB = " + this._dbPath);
Console("Attempting to open DB connection...");
this._sqlCon = new SQLiteConnection(String.Format("Data Source={0};", @"\\Some-PC\ISC\Databases\testdbs\test.db3")); // << ERROR
Console("DB connection succesfull!");
}
private void Console(string text)
{
uiConsoleOutput.AppendText(text);
uiConsoleOutput.ScrollToCaret();
}
}
}
誰能幫我把這個東西的工作?
在此先感謝。