0
votes

I started setting up the windows phone 8 sqlite and everything worked out great. I installed the SQL for Windows phone extension. Then i proceeded on adding the solution (Sqlite.vcxproj). After that i added the files Sqlite.cs and SqliteAsync.cs. Then i referenced the sqlite for windows phone in add reference and everything seemed fine. Finally I added the USE_WP8_NATIVE_SQLITE to the build properties. (I followed -> THIS guide)

First i had problems with SQLite3 missing namespace but then I fixed it after manually adding Community.CsharpSqlite.SQLiteClient.WP.dll, Community.CsharpSqlite.WinPhone.dll, System.Data.Ersatz.WinPhone.dll.

Problem is, when I insert this code:

private async void CreateDatabase()
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "people.db"), true);
await conn.CreateTableAsync<Person>();
}

i keep getting namespace name SQLiteAsyncConnection could not be found (are you missing a directive or an assembly reference?) errors.

is this happening because i cannot add the sqlite3 dll manualy ?( i get the pesky "a reference to a higher version or incompatible assembly cannot be added to the project" error). the SQLite for windows phone is added to the reference tho.

1
Did you deviate from the instructions on sqlite-net-wp8's page? You don't need CSharpSqlite, as sqlite-net-wp8 is meant to be used in its stead as a wrapper around the native sqlite library. SQLiteAsyncConnection should be found as SqliteAsync.cs should be in your project. Note that its namespace is 'SQLite' and not 'SQLite3'. - Peter Huene
I was hoping it would somehow work but to no avail, yes the SqliteAsync.cs is in my project but it still doesnt work, check the comment i made under the bottom answer for a picture of my solution explorer. Everything seems to be in place yet it doesn't work. - Luka S.
You don't need a reference from your project to "SQLite for Windows Phone" as the Sqlite project already contains a reference to it. You should be referencing Sqlite (the one from sqlite-net-wp8) as a project reference from your project. - Peter Huene
And you have a "using SQLite;" statement in the file containing the code above, correct? - Peter Huene
if you get your question solved please give some point who helped you to solve it - loop

1 Answers

0
votes
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "people.db"), true);

Next open connection

await conn.OpenAsync();
string empPersionallInfo = "create table if not exists EmpInfo" + "(no int," + "name varchar(20))";
await conn.ExecuteStatementAsync(empPersionallInfo);