Hi everyone,
I have CountryDataSet1 DataSet created and click on combo drop down list properties. I add CountryDataSet1 to data source and country.Country to Display Member.
so i run program and click on combo drop down list and see if items in combo can be displayed but nothing appears..
how to populate data in combo drop down list from ms access?
Codes here are :
Private Sub PopulateCountryCombo()
Dim cnSQL As OleDbConnection
Dim cmdSQL As OleDbCommand
Dim drSQL As OleDbDataReader
Dim strSQL As String
strSQL = "select Country from country"
cnSQL = New OleDbConnection(ConnectionString)
cnSQL.Open()
cmdSQL = New OleDbCommand(strSQL, cnSQL)
' Use ExecuteReader if select only
drSQL = cmdSQL.ExecuteReader()
cboCountry.Items.Clear()
'Loop through the result set and add the country to
' the combo box
Dim oRow As DataRow
Do While drSQL.Read()
oRow = New DataRow(drSQL.Item("Country").ToString()) --> error display Protected New..so how to resolve it? and am i codings correcting to populate data from ms access in combo drop down list?
cboCountry.Items.Add(oRow)
Loop
' Close and Clean up objects
drSQL.Close()
cnSQL.Close()
cmdSQL.Dispose()
cnSQL.Dispose()
End Sub
regards
ellen
I have CountryDataSet1 DataSet created and click on combo drop down list properties. I add CountryDataSet1 to data source and country.Country to Display Member.
so i run program and click on combo drop down list and see if items in combo can be displayed but nothing appears..
how to populate data in combo drop down list from ms access?
Codes here are :
Private Sub PopulateCountryCombo()
Dim cnSQL As OleDbConnection
Dim cmdSQL As OleDbCommand
Dim drSQL As OleDbDataReader
Dim strSQL As String
strSQL = "select Country from country"
cnSQL = New OleDbConnection(ConnectionString)
cnSQL.Open()
cmdSQL = New OleDbCommand(strSQL, cnSQL)
' Use ExecuteReader if select only
drSQL = cmdSQL.ExecuteReader()
cboCountry.Items.Clear()
'Loop through the result set and add the country to
' the combo box
Dim oRow As DataRow
Do While drSQL.Read()
oRow = New DataRow(drSQL.Item("Country").ToString()) --> error display Protected New..so how to resolve it? and am i codings correcting to populate data from ms access in combo drop down list?
cboCountry.Items.Add(oRow)
Loop
' Close and Clean up objects
drSQL.Close()
cnSQL.Close()
cmdSQL.Dispose()
cnSQL.Dispose()
End Sub
regards
ellen
Last edited: