i have a windows phone application and am trying to connect to a database. The database is valid, i have verified. I am using codeplex’s sqlite client to try to connect.
First i add my database to my project using “>add>Existing item>” and after that i try to connect using the code :
db = new SQLiteConnection(@"Database.db");
db.Open();
Debug.WriteLine("DB opened");
SQLiteCommand cmd = db.CreateCommand("SELECT * FROM Tags");
var lst = cmd.ExecuteQuery<Tags>();
foreach (Tags r in lst)
{
Debug.WriteLine(r.Tag);
}
Debug.WriteLine(":D");
My Tags class looks like this :
public class Tags
{
public int id { get; set; }
public string Tag { get; set; }
}
And i get an error in the sqlite project ( in Sqlite3.Vdbe Prepare()) saying that there is no such table:Tags . The table is there, i’ve viewed the database and the name of the table is correct.
What am i doing wrong?
i’ve found that my database must be in the IsolatedStorage. Here is a sample i found useful http://dotnetslackers.com/articles/silverlight/Windows-Phone-7-Native-Database-Programming-via-Sqlite-Client-for-Windows-Phone.aspx