Skip to content

Recuperar registro de la BBDD y mostrar en un ComboBox desplegable

December 22, 2011

Private Sub carregaComboUsuaris()


Dim sSQL As String = “SELECT accio, descripcio “ & _

“FROM taula” & _

“ORDER BY accio “

Dim idReader As SqlDataReader = New SqlCommand(cmdText:=sSQL, Connection:=g_cn).ExecuteReader()


With idReader

While .Read()


‘ComboBox1.Items.Add(UCase((Trim(.GetString(0)) & Space(8)).Substring(0, 8) & ” ” & .GetString(1)))

End While

End With



MsgBox(Err.Number & ” “ & Err.Description, vbOKOnly, “ERROR”)

Exit Sub

End Try

End Sub


From → Datos

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: