linq to sqlite的更新问题
IDE:vs2010 C#
sqlite provider
http://system.data.sqlite.org/downloads/1.0.80.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.80.0.exe
项目里直接引用的System.Data.Sqlite.dll
表结构:
create table tags( tagId guid primary key, title varchar(50), createdDate datetime)
[Table(Name="tags")]public class Tag{ [Column(Name="tagId",IsPrimaryKey=true,DbType="varchar(50)")] public Guid TagId { get; set; } [Column(Name = "title")] public string Title { get; set; } [Column(Name = "createdDate")] public DateTime CreatedDate { get; set; }}public class TagDataContext : DataContext{ public Table<Tag> Tag; public TagDataContext(SQLiteConnection con) : base(con) { }}
string strcon = "Data Source = notesdb.db3;pooling=true;failifmissing=false;";TagDataContext ctx = new TagDataContext(new SQLiteConnection(strcon));Tag t = ctx.Tag.Single(x => x.Title == "99999");t.Title = "呵呵";ctx.SubmitChanges();