1
Reply

how to pass a value from a drop down list to a string variable

jpknarr

jpknarr

Apr 15 2004 9:56 AM
2.2k
can anyone help me with this please!!! i'm using sql server 2000 for my DB and i've populated a drop down list with a column of the DB. I can't for the life of me pass the selected item into a string variable to do a new query. please help!! code: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim ConnectionString As String = "server=*****;user=jpkasdnfaarr;password=dmbasadfasnasddf41;database=faasdfasdfb23" Dim cnn As New SqlConnection(ConnectionString) Dim da As New SqlDataAdapter("select distinct popout_num from popouts", cnn) Dim ds As New DataSet Dim PopoutsTable As New DataTable PopoutsTable.TableName = "Popouts" da.Fill(ds) 'Fill the Drop Down List with Popout Numbers DropDownList1.DataSource = ds DropDownList1.DataTextField = "popout_num" DropDownList1.DataBind() 'DropDownList1.AutoPostBack = True 'This always puts the initial popout number value in the drop down list. We don't want this to happen. I don't know what else to say. Please Help!! Thank you in advance. DJ

Answers (1)