试图检查二维码值是否与数据库中的用户匹配?

问题描述 投票:0回答:1

我遇到一个问题,当我扫描我的QR码时,会得到用户名的值。我要实现的是在Firebase数据库中与用户子项一起检查QR码值。因此,我试图检查该值是否等于存储的数据库子用户,但是由于某种原因,但是,当我调试if子句未触发时,仅调用else if。谁能帮我解决这个问题。谢谢您的帮助。

这是我的代码:

BarcodeScanner.Scan((barCodeType, barCodeValue) =>
{
  BarcodeScanner.Stop();

  var result = JsonConvert.DeserializeObject<dynamic>(barCodeValue);
  var gettingTheName = (string)result.name.Value; 
  TextHeader.text = gettingTheName;

  // Checking if QR Code value is matching with the child name users in the database. 
  if (gettingTheName == "https://PROJECT_URL.firebaseio.com/users.json")
  {
    SceneManager.LoadScene("Verify");
    Console.Write("Success"); 

  } else if (gettingTheName != "https://PROJECT_URL.firebaseio.com/users.json")
  {
    SceneManager.LoadScene("QRCode");
    Console.Write("Sorry, there is no user matched.");
  }
}); 
c#
1个回答
0
投票

我认为你想要

 @"https://PROJECT_URL.firebaseio.com/users.json"

代替

"https://PROJECT_URL.firebaseio.com/users.json"
© www.soinside.com 2019 - 2024. All rights reserved.