I think I found where the problem is coming from. I did an automated database conversion from SQL Server. Most primary keys are GUIDs. In SQLite, these columns are still defined as 'uniqueidentifier' which is not a valid data type. If I try updating a table that has INT primary key, then it works. So the problem is with the GUID primary key.
SQLite doesn't seem to support this data type, but it kind of does. Can System.Data.SQLite handle these fields properly? How should I define these columns? I also think I read something about needing extra code when inserting new data where the key isn't auto-generated by the database, but can't find where I read that. So... what needs to be done to get this to work? Etienne > From: mysteryx93 at hotmail.com > To: sqlite-users at mailinglists.sqlite.org > Date: Fri, 29 May 2015 20:12:54 -0600 > Subject: Re: [sqlite] LINQ to SQLite Cannot Update: "Store update, insert, or > delete statement affected an unexpected number of rows" > > I tried this very basic code on a very basic table that contains no DATETIME > field. > > var Obj = context.MediaCategories.FirstOrDefault(); > Obj.Folder = "test"; > context.SaveChanges(); > > The table has this format > - MediaCategoryId GUID Primary Key > - MediaTypeId INT > - Name NVARCHAR > - Folder NVARCHAR > > I can't get any more basic than that! > > The generated query is this > > > UPDATE [MediaCategories] > SET [Folder] = @p0 > WHERE ([MediaCategoryId] = @p1); > > -- @p0: 'test' (Type = String) > > -- @p1: '7320f1c6-1834-4c81-a16f-12b733d76038' (Type = Guid) > > -- Executing at 29/05/2015 9:11:54 PM -05:00 > > -- Completed in 0 ms with result: 0 > > > If I run this query manually, it works. > > > Etienne > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users