I am trying to create a query where I select a particular row based on a selection made from a radiolistbox in an aspx page. I have captured the selection using Context.Items.Add("") and Server.Transfer. I guess I could also use Sessions to do the same.
On the next page I capture the values okay and then want to query the database for a particular row value (actually I will be making a multiple query, but only one with a called row).
Can I assign a variable to the Select statement and how is this done?
For instance: "SELECT tbl1. [variable] FROM tbl1....."
[b]Mysql Select Statement with variables[/b]
Re: [b]Mysql Select Statement with variables[/b]
You cannot pass parameters as you specified in your example.
Generate CommandText yourself, for example:
Generate CommandText yourself, for example:
Code: Select all
mySqlCommand.CommandText = string.Format("SELECT tbl1.{0} FROM tbl1", columnName);