Check out example codes for "mysql executeScalar only if successful". It will help you in understanding the concepts better.

Code Example 1

MySqlCommand cmd = new MySqlCommand(connection);
cmd.CommandText = sqlstring;
Object userNameObj = cmd.ExecuteScalar();

if (userNameObj != null)
  string returnedName = userNameObj.ToString();
 ...

Learn ReactJs, React Native from akashmittal.com