I am trying to load data into a cboBox but it fails on the do while loop. does anyone have a clue?
Code:Private Function FillComboBoxFromDataReader() 'Purpose: Populate the combo box with countries list, from a DataReader Dim sqlConn As SqlConnection 'Form-level connection object Dim drCountries As SqlDataReader 'Form-level DataReader object 'Create a Connection object sqlConn = New SqlConnection(SQL_CONNECTION) 'Load list of countries into the combo box, from the DataReader Call ListCountriesInDataReader(sqlConn, drCountries) 'Populate the combo box cboCountries, with the DataReader output Do While drCountries.Read() 'Do something with the row cboCountries.Items.Add(drCountries.Item("Country")) Loop 'Close DataReader drCountries.Close() 'Close the Connection sqlConn.Close() End Function


Reply With Quote
