title: Getting a String from a value in Mysql in C#
body: <p>i have the following table in MySql :</p>
  
  <pre><code>ID          Name
  
  1           Google
  2           Yahoo
  3           Facebook
  4           Whatever
  </code></pre>
  
  <p>I have a textfield that when someone writes something and presses a button it stores this value in a string. This string is the Name of the above table. Then i have my code about selecting the id referred to that name. Ex, if the user enters Facebook i will find that the ID = 3. this is the code :</p>
  
  <pre><code>    public bool FindCompanyID(string companyName)
  {
      return ExecQuery("select id from companies where name=@name",
          cmd =&gt;
          {
              cmd.CommandText = "SELECT id from companies WHERE name ='" + companyName + "'";
              return cmd;
          });
  }
  </code></pre>
  
  <p>I want someone to show me a sample of code about the following : Saving to a string the " id " . if the ID in the database = 2 i want to make a </p>
  
  <pre><code>int Company_Number_ID
  </code></pre>
  
  <p>that i will use. How can i get the string to read the specified value from the database?</p>