【发布时间】:2018-03-22 05:06:05
【问题描述】:
当我清理我的表时,我还希望重置自动增量 rowid 编号。我发现了几篇推荐此代码的帖子:
DeleteAll<mytable>();
Execute("update sqlite_sequence set seq = 0 where name = 'mytable';");
当我运行它时,我没有收到任何错误,但 rowid 没有重置。我也试过:
Execute("delete from sqlite_sequence where name = 'mytable';");
... 结果相同。 sqlite-net-pcl 是否有一个怪癖使它不起作用?还是我错过了什么?
表定义如下所示:
public partial class mytable : IHasId
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
<other stuff deleted>
}
而 IHasId 是:
public interface IHasId
{
int Id { get; set; }
}
(别开枪,我在有芝士汉堡的时候写了这篇文章。当时我觉得很有趣......而且,不,这张桌子实际上并没有命名为 mytable。)
任何帮助将不胜感激。 谢谢!
【问题讨论】:
标签: c# xamarin.forms sqlite-net