I've looked here before with this error but the results won't work for me.
I have made a login form and it works fine for one time. After I logged in once and restart the app and try to log in I'm getting the error.
Function:
public int SaveUser(User user)
{
lock (locker)
{
if (user.Id != 0)
{
database.Update(user);
return user.Id;
}
else
{
return database.Insert(user);
}
}
}
User model:
[Table("User")]
public class User
{
[PrimaryKey, AutoIncrement, NotNull]
public int Id { get; set; }
[Unique]
public string Username { get; set; }
public string Password { get; set; }
}
Update: I hope this are the details that's needed for further help.
02-27 14:13:15.806 I/MonoDroid(23447): at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery (System.Object[] source) [0x00121] in /Users/vagrant/git/src/SQLite.cs:2668
02-27 14:13:15.806 I/MonoDroid(23447): at SQLite.SQLiteConnection.Insert (System.Object obj, System.String extra, System.Type objType) [0x000f4] in /Users/vagrant/git/src/SQLite.cs:1415
02-27 14:13:15.806 I/MonoDroid(23447): at SQLite.SQLiteConnection.Insert (System.Object obj) [0x00005] in /Users/vagrant/git/src/SQLite.cs:1281
02-27 14:13:15.806 I/MonoDroid(23447): at KleynGroup.Data.UserDatabaseController.SaveUser (KleynGroup.User user) [0x00038] in C:\Users\[name]\source\repos\KleynGroup\KleynGroup\KleynGroup\Data\UserDatabaseController.cs:48
Sorry if there are a lot of mistakes. I'm new to Xamarin and still learning.
I hope you guys can help me
!=nullbranch is taken? What exception is thrown? With that little details it's hard to tell what is going wrong.