我对sqlite非常陌生,可以在C#中使用。所以我在bin文件夹中创建了db。我在下面创建了一个类。
class myCon{
public SQLiteConnection GetConnection(){
string str = @"Data Source=gf.sqlite3";
SQLiteConnection con = new SQLiteConnection(str);
con.Open();
return con;
}
}
然后我将其称为如下测试我的插入
try {
myCon getMyCon1 = new myCon();
SQLiteConnection con = getMyCon1.GetConnection();
string sql = "insert into nam (Id, test1) values ('3000')";
SQLiteCommand command = new SQLiteCommand(sql, con);
command.ExecuteNonQuery();
}
catch (Exception ex) {
MessageBox.Show(ex.ToString());
}
我已经确认使用gui浏览器表和db在那里。我只是不知道出了什么问题?