title: populate textbox from SQL query, after selection at dropdownlist
body: <p>May i have a working sample on how to retrieve records from a DB &amp; populate the relevant textboxes after a selection at a dropdownlist. What i have is definitely not working &amp; im working on VS 2008. Can anyone show me the way?</p>
  
  <p>What i have:</p>
  
  <pre><code>    Dim myConn As New SqlConnection
      Dim myCmd As New SqlCommand
      Dim dtrReader As SqlDataReader
  
      myConn.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
      myCmd = myConn.CreateCommand
  
      myCmd.CommandText = "SELECT * FROM Product WHERE product_id = '" &amp; DropDownList2.Text &amp; "'"
          'myCmd.CommandType = CommandType.Text
  
          'populate controls from DB
          'myCmd.Parameters.Add(New SqlParameter("@product_id", a))
          myCmd.Parameters.Add(New SqlParameter("@product_name", (txtProductName2.Text)))
          myCmd.Parameters.Add(New SqlParameter("@product_title", txtProductTitle2.Text))
          myCmd.Parameters.Add(New SqlParameter("@product_desc", txtProductDescription2.Text))
          myCmd.Parameters.Add(New SqlParameter("@product_author", txtProductAuthor2.Text))
  
          mycmd.Dispose()
          myConn.Close()
          myConn.Dispose()
  </code></pre>