在这里,我试图获取登录页面上已登录的用户,但我不明白为什么_id,名称和类无法在该方法中获取任何数据。
public class Login
{
SQLiteConnection _sqlconnection = DependencyService.Get<ISQLiteConnection>().GetConnection();
SQLiteManager manager;
public static int _id;
public static string _name;
public static string _class;
public void LoginMethod()
{
string name = LoginPage.Name;
string password = LoginPage.Password;
string getId = "SELECT Id FROM Users WHERE Name='" + name +"' AND Password='" + password + "'";
var Id = _sqlconnection.CreateCommand(getId);
var id = Id.ExecuteScalar<int>();
var profileUser = manager.Get6(id);
_id = profileUser.Id;
_name = profileUser.Name;
_class = profileUser.Class;
}
}
请帮助。