I am developing a test application for sqlite and am already able to add and request data from the database. The database runs on my windows 10 mobile device running 10.0.10586.29 and I included the SQLite for universal app platform in my references.
When I want to delete a row in a table based on an input id I get the following error: No such table found in (databasename).
I even get this error when I put in a fake DB name. I am sure this is the right database name because I used the connection before and it works fine while adding and requesting. (Also checked the database path en the name is the same)
Since I have no way of opening the database on my windows mobile device to verify the database names (Is there a way to look into the database of your mobile?)
I was wondering if you would know the fix to my error.
The code is the following:
string _path;
SQLite.Net.SQLiteConnection conn;
public showSqlData()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
_path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), _path);
conn.CreateTable<Message>();
DisplayDatabase();
}
private void deleteDatabaseData_Tapped(object sender, TappedRoutedEventArgs e)
{
using (conn)
{
Debug.WriteLine(conn.DatabasePath);
var existingconact = conn.Query<Message>("select * from db where id =" + idBox.Text).FirstOrDefault();
if (existingconact != null)
{
conn.RunInTransaction(() =>
{
conn.Delete(existingconact);
});
}
}
}
Aucun commentaire:
Enregistrer un commentaire