SQL Add (All Cities) To Ddl Without Having It In The DB
Apr 11, 2008
Basically what i have is a ddl that gets filled with column data "BidCity" in the C# code behind. with this code.
All im interested in is how to add a value("with SQL") that doesnt exist in the database and have it populated into the ddl with all the other info in the "BidCity" column. read more below.....
Is this even possible with SQL?
private void DoCitiesInit()
{
//CONNECTION STRING
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["connString"]);
DataSet dsCities = new DataSet();
SqlDataAdapter daCities = new SqlDataAdapter("SELECT DISTINCT Bids.BidCity, Bids.BidStatusID FROM Bids WHERE Bids.BidState = '" + ddlStates.SelectedValue + "' AND Bids.BidStatusID = 1 ORDER BY Bids.BidCity ", conn);
daCities.Fill(dsCities, "Bids");
ddlCities.DataTextField = "BidCity";
ddlCities.DataValueField = "BidCity";
ddlCities.DataSource = dsCities;
ddlCities.DataBind();
}
I would like to add a text field value "(All Cities)" to my ddl with the other data that gets populated into the ddl, and have that selection have a value(999 or whatever) without having to put this in the database. My reason behind this madness is that if i put this data into a row in the same table it will get populated into the gridview with the rest of my code.
Basically i am working with a database i myself did not design and i cannot change the database as it is being used for a windows application and i am using this table to populate for a website for end users. if i dont make sense please let me know. Im used to it.
Thanks