Step1.
Download coma separated .CSV country file.
Step2.
Create new table for country
suppose CountryId,Country are their fields.
USE TestData
GO
CREATE TABLE Tbl_COUNTRY
(
CountryId VARCHAR(40),
Country VARCHAR(40)
)
GO
Step3.
Now run following script to load all the data from CSV to database table
BULK
INSERT Tbl_COUNTRY
FROM 'c:\country_data.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
Step4.
protected void Page_Load(object sender, EventArgs e)
{
ddlLocation.DataSource = LoadCountryData() as DataTable;
ddlLocation.DataTextField = "Country";
ddlLocation.DataValueField = "CountryId";
ddlLocation.DataBind();
}
Download countrylist.csv
countrylist.txt[
^]
coutrylist.csv[
^]