title: Get int value from command in c#
body: <pre><code>string sql = "Select UserId From User where UserName='Gheorghe'";
  
  
  SqlCommand cmd=new SqlCommand(sql, connection);
  cmd.ExecuteScalar(); //this statement return 0
  </code></pre>
  
  <p>but I want to get the id of user?
  how can I get it?</p>