in

System.Data.SQLite

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

Got a strange error

Last post 03-24-2011 12:53 PM by Roger. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-04-2010 2:46 PM

    Got a strange error

    Hey,

    Im not sure if its a bug or not - but i place it here :)

    In this code:

           private List<ReadingDTO> Multiple(SQLiteDataReader reader)
            {
                List<ReadingDTO> all = new List<ReadingDTO>();
                try
                {
                    ReadingDTO r;
                    while (reader.Read())
                    {
                        r = new ReadingDTO();
                        r.Average = (decimal)reader["Average"];
                        r.Id = Convert.ToInt32(reader["ID"]);
                        r.Reading = Convert.ToInt32(reader["Reading"]);
                        r.ReadingDate = Convert.ToDateTime(reader["ReadingDate"]);
                        r.ReadingTypeId = Convert.ToInt32(reader["ReadingTypeID"]);
                        r.Usage = Convert.ToInt32(reader["Usage"]);
                        string temp = reader["WeatherTemp"].ToString();
                        if(temp != string.Empty)
                        {
                            r.WeatherTemp = Convert.ToInt32(temp);
                        } else
                        {
                            r.WeatherTemp = 0;
                        }
                        all.Add(r);

                    }
                }
                catch (Exception exception)
                {
                    logger.ErrorException("Multiple - ",exception);
                }
                return all;
            }

    I often get this error:

    04-03-2010 22:14:09 - Error - Forbrugsudgifter.Library.Databases.Settings.GetByKey -  - System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
       at System.Data.SQLite.UnsafeNativeMethods.sqlite3_prepare_interop(IntPtr db, IntPtr pSql, Int32 nBytes, IntPtr& stmt, IntPtr& ptrRemain, Int32& nRemain)
       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.SQLiteDataReader.NextResult()
       at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
       at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
       at Forbrugsudgifter.Library.Databases.Settings.GetByKey(String key) in F:\Visual Studio 2008\Projects\Forbrugsudgifter\Forbrugsudgifter\Forbrugsudgifter.Library\Databases\Settings.cs:line 92


    But it's not a consistent error, i have only a few times managed to track it down in debugging and it always appear in the " while (reader.Read())".

    Is it a error in the framework or is as it says a error in my ram ?

    Any suggestion would be preciated :)


    Best Regards

    Bjarne Pedersen
    Denmark
  • 03-24-2011 12:53 PM In reply to

    • Roger
    • Not Ranked
    • Joined on 03-24-2011
    • Posts 4

    Re: Got a strange error

    Did you ever resolve this? I am seeing the same issue.
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems