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

View 5 Replies


ADVERTISEMENT

Countries && Cities Tables

Jan 19, 2007

I need to have tables of world countries and cities to use in a user registration form, I searched the Internet for scripts,xml,excel files for countries & cities lists but I couldn't find. Can anybody tell me where to get them from?

View 6 Replies View Related

Retrieve Data Form A Country Combined With 3 To 4 Cities

Feb 12, 2015

This Question is pertaining to AND and OR operators.

If we want to retrieve data form a country combined with 3 to 4 cities how do we handle this?

Say for ex:- i want to retrieve all data from Customers table where country is Germany and cities are Berlin, Mannheim,Brandenburg and München.

View 1 Replies View Related

Need To Produce A Query That Show The Cities And The Number Of People Per City?

Jan 31, 2008



Please help!!!!
Need to produce a query that show the cities and the number of people per city?
simple table
firstname
lastname
age
location

location shows the dif cities and the sql query will show cities will a count of people per city

how do you do this?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved