dropdownlist selection to a string

S

scurenton

I have a dropdownlist that gets its data from a SQL table. How can I
take the actual text that a user selects and put it to a string.
This is what I tried:


// open my connection
vendorDBconn.open();
//Create a string variable from the selected item in ddl1
string ddlSelection = ddl1.SelectedItem.Text;
//Create SQL statement string to get bidID# where bid_cat_desc is
equal to text selected in ddl1

string SelectID = "SELECT bid_cat_id FROM bid_cat_lookup WHERE
bid_cat_desc = '" + ddlSelection + "'";



No need to keep typing because when I add a break point at "string
ddlSelection..... and step through it I can see that the ddl
selection is not going into the string var ddlSelection. How do I
properly do this. Any example would be appreciated. Thanks[/code]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top