title: Select single row from database using mysql connector .NET
body: <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I've just heard about the mysql connector and I want now to take a single row from my database(every row is unique). I don't want to use a loop because it would be useless(only for one row?..). I know how to connect to a database but I just can't figure out how to select a single row. This is my code :</p>
  
  <pre><code>       ''Register user in dtb
          cmd = New MySqlCommand("INSERT INTO `users`(`name`, `ip`, `status`) VALUES ('" &amp; My.User.Name.Split("\")(1) &amp; "','" &amp; ip_temp &amp; "','1')", conn)
          cmd.ExecuteNonQuery()
  
  
          ''Get user's Id from dtb  --&gt;this is where I'm having troubles
          cmd = New MySqlCommand("SELECT 'id' FROM `users` WHERE name='" &amp; My.User.Name.Split("\")(1) &amp; "' ", conn)
          dtb_data = cmd.ExecuteScalar
  
          Debug.Print(dtb_data(0))
  </code></pre>
  
  <p><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  It doesn't work. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The error is: "<strong>Unable to cast object of type 'System.String' to type 'MySql.Data.MySqlClient.MySqlDataReader'.</strong>" (of course...). I know that it must look something like "dtb_data['id']" (from php) but this command doesn't exist in VB.Net. What should I do?</p>