Click here to Skip to main content
15,867,330 members
Articles / Database Development / MySQL

query database with selected variables in mysql

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
11 Oct 2012CPOL 0  
MySqlCommand cmd = new MySqlCommand("Select * from table where variable = '@selectedValue'");cmd.Parameters.AddWithValue("@selectedValue", value);...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
11 Oct 2012Al Hizbul
select * from table where variable in (selected tableColumn from dropdownlist)
Please Sign up or sign in to vote.
10 Oct 2012mrDivan 3 alternatives  
i am trying to do a c# mysql select * from table where variable =(selected tableColumn from dropdownlist) like variable(text from text box does anyone know what the query should look like in my sql
Please Sign up or sign in to vote.
16 Oct 2012mrDivan
turns out you cannot use column names as a parameter in mysql so I wrote I different select statement for each column chose from the dropdown list

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions