title: To fix an error like 'cannot implicitly convert type object to string'
body: <p>I am using a class in <a href="/questions/tagged/asp" class="post-tag" title="show questions tagged &#39;asp&#39;" rel="tag">asp</a> project. But I am facing sql error
  an duse this code</p>
  
  <pre><code>public string GetScalerValue(string Qstr)
  {
      cmd.Parameters.Clear();
      cmd.CommandType = CommandType.Text;
      cmd.CommandText = Qstr;
      cmd.Connection = constr;
      string retvalue = null;
      try
      {
          CreateConn();
          retvalue = cmd.ExecuteScalar();
      }
      catch (Exception ex)
      {
          return ex.Message;
      }
      finally
      {
          CloseConn();
      }
      return retvalue;
  }
  </code></pre>
  
  <p>on <code>cmd.ExecuteScalar();</code><br>
  it produce this error.</p>