I'm using Xamarin for Android and the Sqlite-net Nuget for SQL and have the following Code
protected void settingTags() {
using (var connection = new SQLiteConnection (dbPath)) {
var rowCount = connection.Table<User> ().Count ();
if (rowCount <= 1) {
var presentUser = connection.Get<User> (1);
presentUser.Persons = persons;
connection.Update (presentUser);
Log.Info (Tag, "User Data Updated");
}
else if (rowCount > 1) {
for (int i = rowCount; i >= 1; i--) {
connection.Delete(new User(){ID=i});
}
settingTags ();
}
}
}
This gives me an empty exception Error. I used Breakpoints to pinpoint the error and somehow it is in the line:
if (rowCount <= 1) {
And of course the other conditional. I really don't know why this would be an error as such an if-conditional is used in the documentation.
I'd really appreciate any help. And sorry if I used wrong tags or something like that for this question as this is my first. :s
Aucun commentaire:
Enregistrer un commentaire