The code is below. I want to put the year in the combo box for the user to select and then the database name to go in the selected value position.
Code:Private Sub load_year_combobox() Try : Dim SQLdtr2 As Data.OleDb.OleDbDataReader : Dim SQLcmd As Data.OleDb.OleDbCommand Dim sql_select As String = "" : Dim timer_integer As Integer = 0 : Dim timer_count As Integer = 0 sql_select = "SELECT db_name, year_id " + _ "FROM tbl_past ORDER BY ID" SQLcmd = New Data.OleDb.OleDbCommand(sql_select, mainconnection) mainconnection.Open() : SQLdtr2 = SQLcmd.ExecuteReader cmbYear.Items.Clear() : cmbYear.Items.Add("Select Year to Search") Do : While SQLdtr2.Read() cmbYear.Items.Add(SQLdtr2(1)) 'SQLdtr2(0) End While Loop While SQLdtr2.NextResult : mainconnection.Close() Catch ex As Exception MsgBox(ex.ToString) : m.errors(show_error, ex.ToString, error_l) End Try End Sub




Reply With Quote