title: ASP VB - Dropdownlist data to label
body: <p>I'm new to ASP.net programming and I have a question about how to pass data that's retrieved from a dropdownlist and to then populate it into a label so it can be stored in a db. This should be an easy answer from someone but i'm stuck. I'm in pretty deep right now and this is all that's left to complete my form. Here's the code below;</p>
  
  <pre><code>    Private Sub FillPersonList()
  
      Dim strConn As String = ConfigurationManager.ConnectionStrings("SQL2K-ConnectionString").ConnectionString
      Dim con As New SqlConnection(strConn)
      Dim cmd As New SqlCommand()
      cmd.Connection = con
      cmd.CommandType = CommandType.Text
      cmd.CommandText = "SELECT Distinct(LName +',  '+ FName) AS 'Name', PNumber FROM [SQL88K].ASD.dbo.Check WHERE insertdatetime BETWEEN getdate() - 7 AND getdate() And Room = @Room"
  
      cmd.Parameters.AddWithValue("@Room", DDRoom.SelectedItem.Value)
  
      Dim objDs As New DataSet()
      Dim dAdapter As New SqlDataAdapter()
      dAdapter.SelectCommand = cmd
      con.Open()
      dAdapter.Fill(objDs)
      con.Close()
      If objDs.Tables(0).Rows.Count &gt; 0 Then
          DDPerson.DataSource = objDs.Tables(0)
          DDPerson.DataTextField = "PName"
          DDPerson.DataValueField = "PName"
          lblPNumber.Text = "PNumber"          'This is where i'm trying to populate the label!
          DDPerson.DataBind()
          DDPerson.Items.Insert(0, "&lt;--Select Person--&gt;")
      End If
  End Sub
  </code></pre>