I am trying out System.Data.SQLite.LINQ and I am getting crashes with FirstOrDefault().
I have created a table with the SQL: CREATE TABLE Person( Id INTEGER PRIMARY KEY, Name TEXT NOT NULL, Age INTEGER NOT NULL ); The C# class I am reading into is defined as: [TableAttribute(Name="Person")] public class Person { [ColumnAttribute(Name = "Id", DbType = "INT", IsPrimaryKey = true)] public int Id { get; set; } [ColumnAttribute(Name = "Name", DbType = "VARCHAR(MAX)", CanBeNull = false)] public string Name { get; set; } [ColumnAttribute(Name = "Age", DbType = "INT", CanBeNull = false)] public int Age { get; set; } } I know that the type of Name does not match the definition, but changing it to TEXT gives error on comparisons. My project is at github: https://github.com/trulsu/SQLiteTest I am using the latest official version (1.0.77.0) on Windows7 with .NET 4.0. The full error message (including stack trace) is: ----- BEGIN ----- System.Data.SQLite.SQLiteException was unhandled Message=SQLite error near ".": syntax error Source=System.Data.SQLite ErrorCode=-2147467259 StackTrace: at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain) at System.Data.SQLite.SQLiteCommand.BuildNextCommand() at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index) at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate) at SqLiteTest.Program.PersonTest(SqLiteDataContext connection) in C:\source\Prototypes\SqLiteTest\SqLiteTest\Program.cs:line 77 at SqLiteTest.Program.Main() in C:\source\Prototypes\SqLiteTest\SqLiteTest\Program.cs:line 17 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: ----- END ----- Any help would be greatly appreciated, Truls. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users