Search code examples
c#sqliteraspberry-pimonodevelop

Raspberry Pi, C#, Monodevelop,Sqlite - no such table, filename unknown


I have small test Sqlite database on my Raspberry Pi2.

Connection string is:

con = new SqliteConnection("Data Source=test.db,version3");

If I want fetch data, I use:

cmd = new SqliteCommand("SELECT * FROM users",con);
reader = cmd.ExecuteReader();
while(reader.Read()){ 
.... 
}

I get this Exception:

Mono.Data.Sqlite.SqliteException: SQLite error
no such table: users
at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection cnn,
System.String strSql, Mono.Data.Sqlite.SqliteStatement previous,
UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0

I'll grateful for whatever advice.


Solution

  • The problem is in your connection string, it should be like this: "Data Source={path-to-your-database-file}test.db;Version=3;"