-1
Ich habe einen Namen Kombinationsfeld cbSectionWie bevölkern Daten in Kombinationsfeld von SQL Server
Wie kann ich die Daten aus SQL Server in Kombinationsfeld zu füllen?
Jede mögliche Idee
-Danke
Ich habe einen Namen Kombinationsfeld cbSectionWie bevölkern Daten in Kombinationsfeld von SQL Server
Wie kann ich die Daten aus SQL Server in Kombinationsfeld zu füllen?
Jede mögliche Idee
-Danke
Dies ist die direkte Hilfe von VbForums (I für den Code keinen Kredit nehmen!), Erstes Ergebnis für eine schnelle Google-Suche.
Dim strSQL as String 'Declare the variables we need
Dim oRS as ADODB.Recordset
Set oRS = New ADODB.Recordset
'Load the data
'** change this SQL to load the data you want.
strSQL = "SELECT Colour FROM Colours"
'** change oConn to the name of your Connection object
oRS.Open strSQL, oConn, adOpenForwardOnly, adLockReadOnly, adCmdText
'Fill the combo box (or ListBox)
'** change the name of the combo to the one you want to fill
With cboColour
.Clear
Do While Not oRS.EOF
'** change the name of the field here to the one you want to show
.AddItem oRS.fields("Colour").value
oRS.MoveNext
Loop
End With
'Tidy up
oRS.Close
Set oRS = Nothing