//**************************************************************************************************** //添加市 private void addCity() { foreach (DataRow dr in ds.Tables[0].Rows) { if (((dr[4].ToString() != "") && (dr[5].ToString() == "")) || (dr[1].ToString() == "北京市" || dr[1].ToString() == "天津市" || dr[1].ToString() == "上海市" || dr[1].ToString() == "重庆市") && (dr[4].ToString() != "") && (dr[5].ToString() != "")) { string strParentId = new ModCity().setWhere("cityCode = '" + dr[4].ToString() + "'").getField("id"); string strInsert = string.Format("insert into ay_city (parentId, cityCode, cityName, spell, firstSpell) values ({0}, '{1}', '{2}', '{3}', '{4}')", strParentId, dr[6], dr[3], ConvertSpell.get(dr[3].ToString()), ConvertSpell.getFirst(dr[3].ToString())); int n = new ModCity().getQuery(strInsert); } } }
//**************************************************************************************************** //添加县 private void addCounty() { foreach (DataRow dr in ds.Tables[0].Rows) { if (dr[4].ToString() != "" && dr[5].ToString() != "" && dr[6].ToString() != "" && dr[1].ToString() != "北京市" && dr[1].ToString() != "天津市" && dr[1].ToString() != "上海市" && dr[1].ToString() != "重庆市") { string strParentId = new ModCity().setWhere("cityCode = '" + dr[5].ToString() + "'").getField("id"); if (strParentId == "") { strParentId = "-1"; } string strInsert = string.Format("insert into ay_city (parentId, cityCode, cityName, spell, firstSpell) values ({0}, '{1}', '{2}', '{3}', '{4}')", strParentId, dr[6], dr[3], ConvertSpell.get(dr[3].ToString()), ConvertSpell.getFirst(dr[3].ToString())); int n = new ModCity().getQuery(strInsert); } } //update ay_city set parentId = (select top 1 id from ay_city where cityName = '徐州市' and cityCode = '320300') where parentId = -1 and cityCode = '320402'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '徐州市' and cityCode = '320300') where parentId = -1 and cityCode = '320404'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '徐州市' and cityCode = '320300') where parentId = -1 and cityCode = '320411'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '徐州市' and cityCode = '320300') where parentId = -1 and cityCode = '320412'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '徐州市' and cityCode = '320300') where parentId = -1 and cityCode = '320413'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '徐州市' and cityCode = '320300') where parentId = -1 and cityCode = '320481'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '驻马店市' and cityCode = '411700') where parentId = -1 and cityCode = '419001'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '恩施土家族苗族自治州' and cityCode = '422800') where parentId = -1 and cityCode = '429004'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '潜江市' and cityCode = '429005') where parentId = -1 and cityCode = '429006'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '潜江市' and cityCode = '429005') where parentId = -1 and cityCode = '429021'; //-- update ay_city set parentId = (select top 1 id from ay_city where cityName = '' and cityCode = '') where parentId = -1 and cityCode = '441900'; --东莞市 //-- update ay_city set parentId = (select top 1 id from ay_city where cityName = '' and cityCode = '') where parentId = -1 and cityCode = '442000'; --中山市 //-- update ay_city set parentId = (select top 1 id from ay_city where cityName = '' and cityCode = '') where parentId = -1 and cityCode = '460400'; --儋州市 //update ay_city set parentId = (select top 1 id from ay_city where cityName = '三亚市' and cityCode = '460200') where parentId = -1 and cityCode = '469001'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469005'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469006'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469007'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469021'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469022'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469023'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469024'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469025'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469026'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469027'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469028'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469029'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '琼海市' and cityCode = '469002') where parentId = -1 and cityCode = '469030'; //-- update ay_city set parentId = (select top 1 id from ay_city where cityName = '' and cityCode = '') where parentId = -1 and cityCode = '620201'; --嘉峪关市 //update ay_city set parentId = (select top 1 id from ay_city where cityName = '武威市' and cityCode = '620600') where parentId = -1 and cityCode = '620702'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '武威市' and cityCode = '620600') where parentId = -1 and cityCode = '620721'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '武威市' and cityCode = '620600') where parentId = -1 and cityCode = '620722'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '武威市' and cityCode = '620600') where parentId = -1 and cityCode = '620723'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '武威市' and cityCode = '620600') where parentId = -1 and cityCode = '620724'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '武威市' and cityCode = '620600') where parentId = -1 and cityCode = '620725'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632321'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632322'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632323'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632324'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632521'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632522'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632523'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632524'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '海北藏族自治州' and cityCode = '632200') where parentId = -1 and cityCode = '632525'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659001'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659002'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659003'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659004'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659005'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659007'; //update ay_city set parentId = (select top 1 id from ay_city where cityName = '阿勒泰地区' and cityCode = '654300') where parentId = -1 and cityCode = '659008'; }
//**************************************************************************************************** //添加省 private void addProvince() { foreach (DataRow dr in ds.Tables[0].Rows) { if (dr[4].ToString() == "") { string strInsert = string.Format("insert into ay_city (cityCode, cityName, spell, firstSpell) values ('{0}', '{1}', '{2}', '{3}')", dr[6], dr[3], ConvertSpell.get(dr[3].ToString()), ConvertSpell.getFirst(dr[3].ToString())); int n = new ModCity().getQuery(strInsert); } } }