Jump to content

Combo Box + SQL


mekanis
 Share

Recommended Posts

Pessoal tenho este código:

 Private Sub carregar_clientes()
        Dim cliente As String = cmbcliente.Text

        Dim objDataAdapter_cliente As New SqlDataAdapter( _
        "SELECT id_cliente, nome, apelido " & _
        "FROM cliente ", objConnection)

        Dim objDataSet_cliente = New DataSet()
        objDataAdapter_cliente.Fill(objDataSet_cliente, "cliente")

        cmbcliente.DataSource = objDataSet_cliente.Tables(0)
        cmbcliente.DisplayMember = "nome"
        cmbcliente.ValueMember = "id_cliente"

        cmbcliente.Text = Nothing
        cmbcliente.SelectedText = cliente

        objDataAdapter_cliente = Nothing
        objDataSet_cliente = Nothing
    End Sub

E aparece o nome na combobox tudo bem.

Mas queria que aparecesse tambem o apelido e não dá simplesmente para fazer uma coisa destas

cmbcliente.DisplayMember = "nome" & " " & "apelido"

Podiam-me ajudar??

Cumpz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.