I am trying to read all data from the table Condition in a local sqlite database, however i am getting this error: SQL logic error or missing database no such table. The database is located in the same directory as the file that's calling it.
this is my code:
SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=myDatabase.sqlite;Version=3;");
m_dbConnection.Open();
try
{
string sql = "select * from Condition";
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
SQLiteDataReader reader = command.ExecuteReader();
while (reader.Read())
Console.WriteLine("Name: " + reader["name"] + "\tScore: " + reader["id"]);
Console.ReadLine();
return null;
}
catch (Exception exc)
{
return null;
}
finally
{
m_dbConnection.Close();
}
Its crashing at SQL logic error or missing database no such table
any help would be great :)
Aucun commentaire:
Enregistrer un commentaire