sample code for displaying in combobox from sql server

sevenbellls

Member
Joined
Nov 14, 2005
Messages
5
Programming Experience
Beginner
i want to get a items from database(sql) in combobox which is selected from another combobox by using selectedindexchanged

mysample code is given below

Dim str As String = "select product_quantity from stock where product_name='" & DropDownList2.SelectedItem.Selected & "' "
Dim cmd As New SqlCommand(str, conn)
dr = cmd.ExecuteReader()
While dr.Read
'Response.Write(dr(0))
DropDownList1.Items.Add(dr("product_quantity"))
End While
dr.Close()

thnks and regards
laby
 
Back
Top