我有一个使用 sqlite 客户端的应用程序。在应用程序中,我将数据插入表中,我需要自动增量的 Id。无论如何要在executenonquery中获取id吗?s.th 像 sqlparameter 或 ...
我正在使用以下方法来获取数据,我认为 rec 变量保存了 id,但它始终是 rec=1,我不知道这有什么用?
int x= (System.Windows.Application.Current as App).db.Insert
<CsWidget>(ObjWidget, @"Insert into Tbl_Widget (Name) values(@Name");
public int Insert<T>(T obj, string statement) where T : new()
{
Open();
SQLiteCommand cmd = db.CreateCommand(statement);
int rec = cmd.ExecuteNonQuery(obj);
return rec;
}