Private Sub folios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New SqlConnection(Form1.conex)
Dim query As String = "select rut_empresa from empresas"
con.Open()
Using cmd As New SqlCommand(query, con)
Dim rs As SqlDataReader = cmd.ExecuteReader
While rs.Read
cbRutEmpresas.Items.Add(rs("rut_empresa").ToString)
End While
rs.Close()
End Using
con.Close()
End Sub
Private Sub folios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New SqlConnection(Form1.conex)
Dim query As String = "select rut_empresa from empresas"
con.Open()
Using cmd As New SqlCommand(query, con)
Dim adapter As New SqlDataAdapter(cmd)
Dim table As New DataTable()
adapter.Fill(table)
cbRutEmpresas.DataSource = table
cbRutEmpresas.DisplayMember = "id" ' columna id de la tabla empresas
cbRutEmpresas.ValueMember = "rut_empresa" ' columna rut_empresa de la tabla rut_empresa
End Using
con.Close()
End Sub
fuente1
fuente2
fuente3
No hay comentarios.:
Publicar un comentario