又是我,那个使用 SQLite-net 的人。当我的表的主键上没有 AutoIncrement 时,我的代码可以正常工作。我想自动增加键,所以我重建了这样的表:
using SQLite;
namespace VehicleTracks.Models
{
public class vehicles
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public string VehID { get; set; }
public string VehYear { get; set; }
public string VehMake { get; set; }
public string VehModel { get; set; }
public string VehColor { get; set; }
public string EngineID { get; set; }
public System.DateTime PurchaseDate { get; set; }
public string SellerName { get; set; }
public string SellerStreet { get; set; }
public string SellerCityStateZip { get; set; }
public string VehOptions { get; set; }
public string OdomInitial { get; set; }
public string VehBodyStyle { get; set; }
public float PurchaseCost { get; set; }
public byte[] VehPhoto { get; set; }
public string VehType { get; set; }
public string Sold { get; set; }
}
}
现在,当尝试创建表时,我得到“AutoIncrement 附近的语法错误”。我尝试不使用 AutoIncrement,但没有它似乎不会增加 ID。
我可能错过了一些愚蠢的东西。