C# .NET - Search functionality - Asked By vijaya saladi on 30-Jan-12 11:45 PM

Hai..  
                I want to implement the search functionality in my project for that I need all the villages and their zip codes located in India.Where did I found them and how to add them to my database.Please suggest me .





Thank you.,
Vijaya.S
Jitendra Faye replied to vijaya saladi on 30-Jan-12 11:50 PM

For that you have to pass search key in select statement, after that based on where condion you can get values from database.

try this code-

protected void GetDetails_Click(object sender, EventArgs e)
{

{

SqlConnection con = new SqlConnection("con string ");
SqlDataAdapter da;
string mySQL = "SELECT * FROM emptable where empid='" + TxtEmpId.Text + "' ";
da = new SqlDataAdapter(mySQL, con);
con.Open();
DataSet ds = new DataSet();
da.Fill(ds);

if(ds.Tables[0].Rows.Count>0)
{

//Now Filling Details-

TxtEmpId.Text= ds.Tables[0].Rows[0][0].ToString(); //for id
TxtEmpName.Text= ds.Tables[0].Rows[0][1].ToString(); //for name
}
}

Try this code and let me know.

Riley K replied to vijaya saladi on 30-Jan-12 11:58 PM


If you want all the states with all the villages without missing anything here is a product that you can look into

but you got to buy it


http://www.indiamapstore.com/databases/IMS0261.html

the above database consists of states / UTs of India along with the all the district along with 6 lakh villages in india along with the tehsils, blocks of India.

Database contains all the relevant information of state, district, tahsil, village, town, ward, population etc. of India 

Regards

D Company replied to vijaya saladi on 30-Jan-12 11:59 PM
Hello Friend.

Here you have two questions

1) Pin code of all village of a country(though you have not mentioned the country name but i think its India)

either you can directly communicate to concerning authority of Govt. of India from or file an RTI which will give you all exact data.

or visit some existing website they allready have this

http://www.mapsofindia.com/pincode/india/

official site of govt. of india

http://www.indiapost.gov.in/

2) to store it into database , simply use sql server DB create a table

something like pincode detail.

Pinid
pincode
villagename
distrctname
statename

which will help you to get uniq id, because there is a chance that same village name belongs to two different state.
and to fetch the value you can simple use ADO net see the below links



http://www.codeproject.com/Articles/1155/Simple-ADO-NET-Database-Read-Insert-Update-and-Del

let me know if you need more help on this!!
Regards
D
Chintan Vaghela replied to vijaya saladi on 31-Jan-12 12:24 AM

Hello,

 

Check following site

http://www.geopostcodes.com/india_zip_codes

 

 

 

Hope this is helpful !

Thanks