On your page load ...
' the interest profiles
DBconnect()
sqlstr = "Select distinct profile_name from interest_profiles where user_name='System' or user_name='" & Session("username") & "'"
Dim data_adapter2 As New OleDb.OleDbDataAdapter(sqlstr, conn)
Dim data_set2 As New DataSet()
data_adapter2.Fill(data_set2, "interest_profiles")
Dim dv As New DataView
dv = data_set2.Tables("interest_profiles").DefaultView
dv.Sort = "profile_name"
profiles.DataSource = dv
profiles.DataTextField = "profile_name"
profiles.DataBind()
'second approach
'profiles.DataSource = data_set2.Tables("interest_profiles").DefaultView
'profiles.DataTextField = "profile_name"
'profiles.DataBind()
'first approach
'Dim dt2 As DataTable = data_set2.Tables.Item("interest_profiles")
'Dim dr2 As DataRow
'If dt2.Rows.Count > 0 Then
' For Each dr2 In dt2.Rows
' profiles.Items.Add(dr2("profile_name"))
' Next
'End If
profiles.SelectedIndex = 0
conn.Close()
If you want to update the drop down ...
'update the drop down
profiles.Items.Clear()
Dim dv As New DataView
dv = data_set.Tables("interest_profiles").DefaultView
dv.Sort = "profile_name"
profiles.DataSource = dv
profiles.DataTextField = "profile_name"
profiles.DataBind()
profiles.Items.FindByText(profile).Selected = True