Hi,

i'm testing a little code to test sqlite in C# with FrameWork 3.5 SP1 and
earlier Ssytem.Data.Sqlite library.

My code works fine to insert an entity with a specific ID, 
but i'm not able to do it with the autoIncrement...

Someone knows what is wrong in my code ?
Tnanks

* My class table :
[Table ( Name = "PERSONS")]
public class Person {

[Column ( Name = "_id", IsPrimaryKey = true, IsDbGenerated = true )]
public int ID { get; set; }
...

* my code is like 
...
DataContext dtContext = new DataContext(...
dtContext.ExecuteCommand ( "CREATE TABLE ...
table.InsertOnSubmit ( new Person () { ID = 1, Name = "Pierre", Age = 10 }
);
Table<Person> table = dtContext.GetTable<Person> ();
table.InsertOnSubmit ( new Person () { ID = 1, Name = "Pierre", Age = 10 }
);
dtContext.SubmitChanges ();
...

* The dtContext.Log is
 CREATE TABLE [PERSONS] ( [ID] INTEGER PRIMARY KEY AUTOINCREMENT, [Name]
TEXT NOT NULL, [Age] INTEGER )
 -- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build:
3.5.30729.4052

 INSERT INTO [PERSONS]([Name], [Age])
VALUES (@p0, @p1)

SELECT CONVERT(BigInt,SCOPE_IDENTITY()) AS [value]
 -- @p0: Input String (Size = 0; Prec = 0; Scale = 0) [Pierre]
 -- @p1: Input Int32 (Size = 0; Prec = 0; Scale = 0) [10]
 -- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build:
3.5.30729.4052
SQLite error (1): near "SELECT": syntax error

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to