我想在下拉列表的选定值中添加值,因为我想在下拉列表的选定值之前选择一条记录。请帮忙。
Protected Sub ddldomicile_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddldomicile.SelectedIndexChanged
sb_loadstate_Rank()
End Sub
Private Sub sb_loadstate_Rank()
Dim connstring As String = ConfigurationManager.ConnectionStrings("dbcon").ConnectionString
Dim str As String = "select state_rank + Rand(state_rank) as Rank from Rank_Master where AIEEE_Rank = '" + ddl_Rank.SelectedItem.Value() + "'"
con = New SqlConnection(connstring)
cmd = New SqlCommand(str, con)
con.Open()
'Dim dt As New DataTable
'Dim da As New SqlDataAdapter(cmd)
'da.Fill(dt)
drs = cmd.ExecuteReader
If drs.HasRows Then
drs.Read()
txtstate.Text = drs.Item("Rank")
drs.Close()
End If
End Sub