WPF rellenar un combobox con datos de una tabla sql

Tengo una aplicación en vb.net forms

Antes usaba este código y funcionaba bien

Private Sub Ejecutivos(sender As System.Object, e As System.EventArgs) Handles ejecutivo.GotFocus
Dim consultaEjecutivo As String = "select pro.pr_num,pro.pr_nombre from Co_prom pro left join " & _
"cat_correoEjecutivo correo on pro.pr_num = correo.pr_num where correo.pr_num is null"
Dim sql As New SqlCommand(consultaEjecutivo, MiConexion)
sql.CommandType = CommandType.Text
Dim adapter1 As New SqlDataAdapter(sql)
Dim dt As New DataTable
adapter1.Fill(dt)
With ejecutivo
.DataSource = dt
.DisplayMember = "pr_nombre"
.ValueMember = "pr_num"
End With
conexion.Close()
End Sub

pero ahora debo migrar a WPF tengo esto pero no me muestra datos

Public Sub Ejecutivos(sender As System.Object, e As System.EventArgs) Handles cbEjecutivo.GotFocus

Dim consultaEjecutivo As String = "select pro.pr_num,pro.pr_nombre from Co_prom pro left join " &
"cat_correoEjecutivo correo on pro.pr_num = correo.pr_num where correo.pr_num is null"
Dim sql As New SqlCommand(consultaEjecutivo, MiConexion)
sql.CommandType = CommandType.Text
Dim adapter1 As New SqlDataAdapter(sql)
Dim dt As New DataTable
adapter1.Fill(dt)

With cbEjecutivo
.DataContext = dt
.DisplayMemberPath = "pr_nombre"
.SelectedValuePath = "pr_num"
End With
Conexion.Close()
End Sub

¿Cómo mando a llamar datos de mi tabla SQL y rellenar el combobox?

Añade tu respuesta

Haz clic para o