使用以下代码:
public void InsertPlatypiRequestedRecord(string PlatypusId, string PlatypusName, DateTime invitationSentLocal)
{
var db = new SQLiteConnection(SQLitePath);
{
db.CreateTable<PlatypiRequested>();
db.RunInTransaction(() =>
{
db.Insert(new PlatypiRequested
{
PlatypusId = PlatypusId,
PlatypusName = PlatypusName,
InvitationSentLocal = invitationSentLocal
});
db.Dispose();
});
}
}
当我尝试运行程序时,出现了这个错误信息:"SQLite.SQLiteException was unhandled by user code HResult=-2146233088 Message=Cannot create commands from unopened database"
但是,尝试添加 "db.Open()" 并不起作用,因为显然没有这样的方法。