我想在unity中使用sqlite创建登录。但是当我点击登录按钮时,我得到的是sqlite异常:sqlite error。你能帮我解决这个问题吗?
public void login(){
var sql_login = "SELECT username,password FROM my_users WHERE username = @login_username AND password = @login_password;";
SqliteCommand createCommand = new SqliteCommand (sql_login, dbCon);
using (var cmd = dbCon.CreateCommand()) {
cmd.CommandText = sql_login;
cmd.Parameters.AddWithValue("@login_username",login_username.text);
cmd.Parameters.AddWithValue("@login_password",login_password.text);
cmd.ExecuteNonQuery();
SqliteDataReader dr = createCommand.ExecuteReader();
int count = 0;
while(dr.Read()){
count++;
}
if(count == 1){
Application.LoadLevel("Succes");
}
if(count > 1){
print("Duplicate");
}
if(count < 1){
print("Not Found");
}
}
}https://stackoverflow.com/questions/42537265
复制相似问题