Hello, I got the same error message :
It append in a web application. When I try on my computer there is no problem, but when I try on the server, it can read data but no insert works.
Security settings are ok, no antivirus on our pre production platform.
Here is the C# code sample that raise error :
public static void AddNews(News news)
{
using (SQLiteConnection connexion = new SQLiteConnection(SqlLiteConnectionString))
using (SQLiteCommand command = new SQLiteCommand("insert into news (title,date,author,description,encodedtitle) values (@title,@date,@author,@description,@encodedtitle)", connexion))
{
command.Parameters.AddWithValue("@title", news.Title);
command.Parameters.AddWithValue("@date", news.Date);
command.Parameters.AddWithValue("@author", news.Author);
command.Parameters.AddWithValue("@description", news.Description);
command.Parameters.AddWithValue("@encodedtitle", news.EncodedTitle);
//connexion.Open();
//command.ExecuteNonQuery(); -----> This causes following error when uncomment this line and above
using (System.IO.Stream stream = System.IO.File.Open(DatabaseFileName,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite))
{
stream.Close();
} -----> this works
}
}
Error is :
- ErrorCode : -2147467259
- Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.
- Data : System.Collections.ListDictionaryInternal
- InnerException : System.Data.SQLite.SQLiteException: Unable to open the database file
unable to open database file
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
Could someone help me to solve the problem ?