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