本文介绍了保存到数据库异常中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的数据库中保存用户详细信息,每当我点击保存按钮时它显示此错误
无法加载DLL'SQLite.Interop.dll':指定的模块无法找到。(HRESULT异常:0x8007007E)
见下面的代码
I am trying to save user details in my database, whenever i click on save button it shows this error
"Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
See the code below
string dbConnectionString = @"Data Source=database.db;version=3;";
private void btn_save(object sender, RoutedEventArgs e)
{
SQLiteConnection sqliteCon = new SQLiteConnection(dbConnectionString);
//Open connection to database
try
{
sqliteCon.Open();
string Query = "insert into student (Registration Number,First Name,Last Name,Middle Name,Gender,Age,Contact Address,Contact Phone,Email Address,Class) values('" + this.RegTbx.Text + "','" + this.TbxFn.Text + "','" + this.LnTbx.Text + "','" + this.MnTbx.Text + "','" + this.GenCmb.Text + "','" + this.AgeCmb.Text + "','" + this.AddTbx.Text + "','" + this.PhoneTbx.Text + "','" + this.EmTbx.Text + "','" + this.ClassCmb.Text + "',)";
SQLiteCommand createCommand = new SQLiteCommand(Query, sqliteCon);
createCommand.ExecuteNonQuery();
MessageBox.Show("Saved");
sqliteCon.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
请帮助
Kindly help
推荐答案
这篇关于保存到数据库异常中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!