Hi,
I am trying to populate dropdownlist items from the results of a
database query. My code looks like this:
Private Sub PopulateSubByBox(ByVal DBConn As SqlConnection)
Dim DBComm As New SqlCommand
Dim DBReader As SqlDataReader
DBComm.Connection = DBConn
DBComm.CommandText = "SELECT * FROM PERSONNEL ORDER BY PERSONNEL"
DBReader = DBComm.ExecuteReader()
'Now Populate the ddlstSubBy.Items with the results from the DBReader - '
ddlstSubBy.Items(0) = DBReader.GetString(0)
End Sub
I get an error on the last line that ddlstSubBy.Items is a Read-Only
property.
So if it is Read-Only, how do I populate it?
JD