in

System.Data.SQLite

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

DataException: Invalid storage type: DBNull

Last post 12-18-2007 2:08 AM by danny. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 10-01-2007 5:24 AM

    • CarlG
    • Top 25 Contributor
    • Joined on 02-02-2006
    • Karlskrona, Sweden
    • Posts 31

    DataException: Invalid storage type: DBNull

    Hi! I get the above error (DataException: Invalid storage type: DBNull) when I run the new version (1.0.46.0) on my web application. The error appears on a page where I view a Datagrid that is based on an SQLite DB. Regards Carl
    Filed under:
  • 10-01-2007 5:43 AM In reply to

    Re: DataException: Invalid storage type: DBNull

    I'm getting the same error with 1.0.46.0.  In my case when I try to fill a table in the dataset this error occurs.  I looked at the definitions of the columns in the table object in the dataset (yes the table was created in the dataset) and one of the columns had it's datatype set to DBNull.  It so happens that this column is defined as text in the sqlite database but actually contains enpty strings or formatted numbers (Ie 001 etc).  In future it will contain text too which is why I defined it as text.  This was not a problem in 1.0.45.0.  All the other columns in the table in the dataset have correct datatypes.

     I hope this helps to quickly fix this issue.

     Many Thanks.

     Adrian

  • 10-01-2007 5:55 AM In reply to

    • CarlG
    • Top 25 Contributor
    • Joined on 02-02-2006
    • Karlskrona, Sweden
    • Posts 31

    Re: DataException: Invalid storage type: DBNull

    Hi! Thanks for telling! I thought perhaps I had done something wrong. Backing to 1.0.45.0 does fix this, but introduces problems with ExecuteScalar.... which were fixed in 1.0.46.0... Would be GREAT to get a quick fix for this. Thanks! Carl
  • 10-01-2007 9:14 AM In reply to

    Re: DataException: Invalid storage type: DBNull

    I need more information on this asap so I can duplicate the error here.  If anyone would like to send me a sample database, e-mail me: robert at blackcastlesoft dot com

    Robert

     

     

  • 10-01-2007 1:25 PM In reply to

    Re: DataException: Invalid storage type: DBNull

     I think I have found a reproducible way for this : create a view across table(s) which returns no rows, and execute DataAdapter.Fill(dataTable) - an error pops in. If you still can not reproduce it, I will send my db and some code. I use types in forementioned query - but allready tested without TYPES - and still crashes.

  • 10-01-2007 2:03 PM In reply to

    Re: DataException: Invalid storage type: DBNull

    Close enough.  I was able to duplicate the problem.

    Robert

     

  • 11-11-2007 4:07 PM In reply to

    Re: DataException: Invalid storage type: DBNull

     Any news on this issue? I saw SQLite 3.5.2 was out, so just wanted to ask if there will be a new version soon, or to ask for 1.0.46.1 with fix for this included...

  • 11-13-2007 1:18 PM In reply to

    Re: DataException: Invalid storage type: DBNull

    There have been quite a few changes to the core engine with 3.5, so its taking an abnormally long time to get a release out.  I was also waiting for 3.5.2 to even start -- the previous releases were either unstable, or did not work at all on CE.

    Robert

     

  • 11-13-2007 1:20 PM In reply to

    Re: DataException: Invalid storage type: DBNull

    Thanks for the info, Robert. 

  • 12-17-2007 5:31 AM In reply to

    • danny
    • Top 500 Contributor
    • Joined on 03-15-2006
    • Posts 4

    Re: DataException: Invalid storage type: DBNull

    I am still having the problem with the versione 1.0.47.2

    I am getting the error on this query

    SELECT * FROM PARTENERI WHERE CodExtern='RO 13027156'

    UNION ALL

    SELECT CodExtern, Denumire, CodFiscal, Localitate, Adresa, Telefon, SimbolClasa,SimbolCategPret, 0 AS Scadenta, '' AS BancaCont, '' AS RegCom, 0 AS Sold,0 as SoldAgent,DATETIME('NOW') as DataFactScad,DATETIME('NOW') as DataFactScad FROM Parteneri_Noi WHERE CodExtern='RO 13027156'

    ORDER BY DENUMIRE

     

    If I take out the ORDER BY it works. The problem is when the second query the select returns an empty result. If you want I can send you the database.

  • 12-17-2007 10:42 AM In reply to

    Re: DataException: Invalid storage type: DBNull

    The easiest way to see this problem is

    using (SQLiteCommand cmd = cnn.CreateCommand())
    {
        cmd.CommandText = "SELECT NULL";
        using (SQLiteDataReader reader = cmd.ExecuteReader())
        {
          reader.Read();
          Type t = reader.GetFieldType(0);
        }
    }

    The bug occurred when the provider encountered a null value, and had no idea what kind of type to give it (meaning, no table schema to glean a type from).  In such cases, the provider was returning type "DBNull" when a more accurate approach given SQLite's typelessness is to return type "object".

    It's fixed for the .48 release.

    Robert

     

  • 12-18-2007 2:08 AM In reply to

    • danny
    • Top 500 Contributor
    • Joined on 03-15-2006
    • Posts 4

    Re: DataException: Invalid storage type: DBNull

    Any idea when the .48 will be out? If it will take long could you please do a 47.3?

     

     

    Thanks,

    Dan

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