Hello,

I am a member of this list, but I am not sure which email address you 
have.  I have tried the ones that I usually use, but my messages are 
getting held due to not recognizing my address.

I am having a problem doing a Linq Insert using SQLite in Visual Studio 
2015 (Community version) in WIndows 10.  I installed the latest release 
of all of the SQLite code using NuGet immediately before running this 
latest test.

I am assuming that I am doing something wrong, since it's hard to 
believe that a bug this obvious exists in this product, but I sure can't 
see what my error is. I hope someone can point out the problem.  I have 
had this problem in earlier releases, with other tables, with other 
versions of VS, and other versions of WIndows.  I finally decided to 
isolate the logic to the simplest possible situation. and the problem 
persists.

I am not sure if this is a proper way to submit a potential bug report, 
but I can't find any other mechanism for bug reports, and saw an earlier 
mention of submitting bugs to this list.  I hope that I have included 
everything that might be pertinent to this issue - if not, please let me 
know what else is needed.

Thanks

Marv Anderson

I get the following message every time:

SQL Logic error or missing database near "SELECT": syntax error

I think that the problem is with the CONVERT(?), since I cannot find any 
SQLite documentation that mentions this command. But it appears that the 
CONVERT is generated by the SQLite Linq package.

Here is the log file produced by the operation.

     INSERT INTO [Test]([Date1], [Char1], [Int1])
     VALUES (@p0, @p1, @p2)

     SELECT CONVERT(Int,SCOPE_IDENTITY()) AS [value]
     -- @p0: Input DateTime (Size = -1; Prec = 0; Scale = 0) [1/1/0001 
12:00:00 AM]
     -- @p1: Input String (Size = 4000; Prec = 0; Scale = 0) [Testing 
Insert]
     -- @p2: Input Int32 (Size = -1; Prec = 0; Scale = 0) [0]

     this calls the testing logic

         TestInsert test = new TestInsert();
         test.DoTheInsert("Testing Insert");

     this is the class containing the testing logic

         class TestInsert{
              [Table(Name="Test")]
              public  class qTest{
                [Column(AutoSync = AutoSync.OnInsert, IsPrimaryKey = 
true, IsDbGenerated = true)]
                 public int Id{get;set;}
                [Column(UpdateCheck=UpdateCheck.Never)]
                 public DateTime Date1{get;set;}
                [Column(UpdateCheck=UpdateCheck.Never)]
                 public String Char1{get;set;}
                [Column(UpdateCheck=UpdateCheck.Never)]
                 public int Int1{get;set;}
              public    qTest( string Char1){//this let's us set all of 
the values in one line of code
                }//c
              public    qTest(){//this let's us set all of the values in 
one line of code
                }//c
                  }//cl:qProgress
                  public    TestInsert(){
                    //DoTheInsert( "Test");
                    }
                  public    void DoTheInsert( string pChar){//
                    DataContext context = new DataContext( cTb.Db.DB );
                    context.Log = new 
StreamWriter("linq-to-sql-Test.log"){ AutoFlush = true };
                    qTest test = new qTest();
                    test.Char1 = pChar;
                    context.GetTable<qTest>().InsertOnSubmit( test);
                    try {
                       context.SubmitChanges();
                    } catch(Exception ex) {
                    MessageBox.Show(ex.Message);
                    }
                    }//m
                  }

Here is the DDL for the table into which I am trying to do the insert.

     CREATE TABLE [Test] (
       [Id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
       [Char1] NCHAR DEFAULT "Char",
       [Int1] INTEGER NOT NULL DEFAULT 0,
       [Date1] DATETIME DEFAULT (datetime('now')));

Reply via email to