问题
The conn.setPassword and conn.open have error, can SQLite.NET set the password to the sqlite database?
private void Btnsign_Click(object sender, EventArgs e)
{
try
{
SQLiteConnection conn = new SQLiteConnection("Data Source=user.db3;Version=3;");
conn.SetPassword("password");
conn.open();
var data = conn.Table<login>();
var data1 = data.Where(x => x.username == txtusername.Text && x.password == txtPassword.Text).FirstOrDefault();
if (data1 != null)
{
Toast.MakeText(this, "Login Success", ToastLength.Short).Show();
}
else
{
Toast.MakeText(this, "Username or Password invalid", ToastLength.Short).Show();
}
}
catch (Exception ex)
{
Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show();
}
}
来源:https://stackoverflow.com/questions/55235743/xamarin-set-password-to-sqlite-database