Xamarin set password to SQLite database

你。 提交于 2019-12-20 05:13:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!