in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

SourceColumnNullMapping property don't works: total mess!

Last post 08-05-2010 7:06 PM by Robert Simpson. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-12-2010 10:44 AM

    SourceColumnNullMapping property don't works: total mess!

    Hello,

    before bug submit my congratulation for doing a work in a difficult territory like that!

    That said I had a problem in Compact Framework of 1.0.66 with VS2008 (not tested in desktop framework yet) with autogenerated parameters of update and delete commands.
    For being precise the problem is in evaluating the value of @IsNull_PARAMNAME parameters.

    I've investigated in the sources and I've found that problem arrives from BindParameter in SQLiteStatement.cs. When that function evaluate the @IsNull_xxx parameters in the param.Value field we have the field value (!!!) and not the "1" or "0" that tells us if the field is null as expected. Because of that the TableAdapter.Update fails with OverflowException because the code is trying to convert the value of @IsNull_xxx (that is a string value coming from the field value of the DB field) in the Int32 type (the type of @IsNull_xxx parameters).

    I've double checked that the property SourceColumnNullMapping of that paramteter was True.

    Steps to reproduce (I hope at least...):

    1. Create a TableAdapter in a Dataset file in the project from a SQLite table with nullable string fields
    2. Write some code that retrieve data from DB and change something in at least one record that has a value in the nullable string field not representable in Int32 but numeric (something like "12345678901234567890")
    3. Call the strong type TableAdapter.Update and it will fire OverflowException

    My workaround for going into production was to manually change the update and delete commands simplyfing the WHERE statements to the primary key of the tables (ex: "... WHERE (ID = @Original_ID) AND (@IsNull_StrField = 1) AND (StrField IS NULL) .... etc" to "WHERE ID = @Original_ID" where ID is the primary key of the table).

    I hope you'll understand my explanations.. If not please tell me I'll be glad to explain better.

    Thank you in advance,

    Henrik

    Henrik Sozzi
    Compact framework and desktop .net developer
  • 08-05-2010 7:06 PM In reply to

    Re: SourceColumnNullMapping property don't works: total mess!

    I'm trying to follow along, but not quite getting there.  You want me to create a table with string values, load it into a dataset, change one of the columns (a string column) in the dataset with a large integer value, and update the table?

    Can you actually post a full code sample demonstrating the issue, complete with creating the database and table schema?

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems