How do display concatenated columns from combox example: Pat_Lname, Pat_Fname and Pat_MI RRS feed

  • Question

  • I concatenate 3 columns in sql database...using select statement like this

    Select Pat_Lname +' '+ Pat_Fname +' '+ Pat_MI as PatientName from PatientDetails

    in visual studio, I have a combo box that must contain value of concatenated names e.g (Aquino Magnolia O.) 

    here's my code in visual studio

    'Dim sql As New SqlCommand("Select * From PatientDetails ", conn)

            'sql.CommandType = CommandType.Text


            'Dim adapter As New SqlDataAdapter

            'adapter.SelectCommand = sql



            'Dim dataset As DataSet = New DataSet

            'adapter.Fill(dataset, "PatientDetails")


            'cmbPatientName.DataSource = dataset.Tables("PatientDetails")

            'cmbPatientName.DisplayMember = "Pat_Lname"

            'cmbPatientName.ValueMember = " "

    this code shows only the Pat_Lname..


    ruby israel
    Friday, December 30, 2011 4:07 AM