title: Microsoft SQL Server SELECT statement
body: <p>I need help retrieving <code>ReceiptNO</code> column from a database table and saving it into a <code>TextBox</code> or <code>Label</code> for referencing.</p>
  
  <p>CODE:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim da2 As New SqlDataAdapter
  da2.SelectCommand = New SqlCommand("SELECT RecepitNO FROM Receipt WHERE (PaidFor=@PaidFor AND RegNO=@RegNO)")
  da2.SelectCommand.Parameters.Add("@paidFor", SqlDbType.VarChar).Value = cbMonth.Text
  da2.SelectCommand.Parameters.Add("@RegNO", SqlDbType.Int).Value = lblRegNO.Text
  
  cn.Open()
  da2.Update(ds.Tables("Receipt"))
  'da2.SelectCommand.ExecuteNonQuery()
  da2.SelectCommand.ExecuteReader()
  cn.Close()
  </code></pre>