Home

Cannot Open SQLite DB

I am using the SQLite driver but when I try to open the database I just get a tooltip on the connection that says:

error: ArguementException - Value was either to large or too small for an int16.Couldn't store <1000000> in NumericPrecision Column. Expected type is Int16. (Value was either too large or too small for an int16)

Any idea what issue could be? The DB is working fine through my app.

Comments

  • SQLite is somewhat retarded in that it lets you store data of any type in a column, even when you've specified a column type. So it's perfectly legal to store Int32.MaxValue in a Int16 column. This plays havoc with object relational mappers and statically typed languages, because the column values don't fit the stated type.

    With regard integers, there's a workaround in LINQPad's SQLite driver. In the connection properties, tick the checkbox "Map all integers to 64-bit longs". This will map all integer columns to 64-bit integers in .NET. Bear in mind, though, that you'll still come unstuck should you store a string in an integer column.
  • edited July 2018
    Hi Joe,

    I tried that, exactly the same error message (I can email db to you if it helps). Any ideas?

    PS. The database is generated by servicestack OrmLite if that helps with anything.
Sign In or Register to comment.