Here is a code for populating a combo box in visual basic. Dim Connect1 as new ADODB.connection Dim Recordset1 as new ADODB.recordset Dim Sqlstring as String Private Sub Form_Load() Connect1.Constring = "Providers = SQLOLEDB; Data source = pathof the file from which the data is to displayed on the screen; " Connect1.open SqlString = "Select * from Tablename" Recordset1.open sqlstring, connect1, cursor_type_for_the_table, lock_type_for_table recordset1.MoveFirst Combo1.Clear While recordset1.EOF <> True Combo1.AddItem (recordset1!fieldname) recordset1.MoveNext Wend End Sub
|
|
|