public void xxxxxxxxxxxxxx() { DataGroup group = new DataGroup(); group = null; DataEntity de = new DataEntity(); de.RemoveAll(); group = null; string ls_sql = "SELECT ID,/*url_product as */ URL FROM Photo_hongzilan_B1 /**/ WHERE STATUS =1 order by ID";//IS NULL group = DB.GetDataGroup(ls_sql); if (group.Table.Rows.Count > 0) { for (int i = 0; i < group.Table.Rows.Count; i++) { string pig = ""; pig = getUrlSource(group.Table.Rows[i]["URL"].ToString(), "gb2312").Replace("'", "\"");//utf-8 gb2312 if (pig != "") { string ls_up = "UPDATE Photo_hongzilan_B1 SET HTML='" + pig + "' ,STATUS=2 WHERE ID='" + group.Table.Rows[i]["ID"].ToString() + "'"; DB.ExecuteSQL(ls_up); pig = ""; } } } MessageBox.Show("ok!"); }
private void button33_Click(object sender, EventArgs e) { /* * insert into Asics_pic (pid,url_pic,flag,status) * select id,'http://www.asicsshoesmart.com/'+pic_s,'S',1 from Asics_b3 */ DataGroup group = new DataGroup(); DataGroup group_html = new DataGroup(); DataEntity de = new DataEntity(); de.RemoveAll(); group_html = null; string ls_sql = "SELECT ID,pic_group as pic_group FROM Photo_hongzilan_B2 where status=4 order by ID";//WHERE STATUS =2 group_html = DB.GetDataGroup(ls_sql); if (group_html.Table.Rows.Count > 0) { for (int i = 0; i < group_html.Table.Rows.Count; i++) { string ls_shtml = group_html.Table.Rows[i]["pic_group"].ToString(); string[] dog_small = ls_shtml.Split('|'); foreach (string bb in dog_small) { string xx = bb.Trim(); //string ls_up = "insert into ZY_PIC (pid,url_pic,flag,status) values ('" + group_html.Table.Rows[i]["ID"].ToString() + "','http://www.xxx.com/" + xx + "','B',1)"; group = null; string ls_double = "select id from Photo_hongzilan_PIC where url_pic='" + xx + "' and status=1 "; group = DB.GetDataGroup(ls_double); if (group.Table.Rows.Count == 0) { string ls_up = "insert into Photo_hongzilan_PIC (pid,url_pic,flag,status) values ('" + group_html.Table.Rows[i]["ID"].ToString().Trim() + "','" + xx + "','B',2)";//http://www.xxx.com/ DB.ExecuteSQL(ls_up); } } } } MessageBox.Show("OK!"); }
private void button32_Click(object sender, EventArgs e) { try { DataGroup group = new DataGroup(); DataGroup group_html = new DataGroup(); group_html = null; DataEntity de = new DataEntity(); de.RemoveAll(); group_html = null; string ls_sql = "SELECT ID,HTML FROM Photo_hongzilan_B2 WHERE STATUS =2 order by ID"; group_html = DB.GetDataGroup(ls_sql); if (group_html.Table.Rows.Count > 0) { for (int i = 0; i < group_html.Table.Rows.Count; i++) { string ls_shtml = group_html.Table.Rows[i]["HTML"].ToString().Replace("\r\n", "").ToString(); //替换换行符 ls_shtml = ls_shtml.Replace("|", ""); //原先的“|”替换 ls_shtml = ls_shtml.Replace("\"", ""); //原先的“|” //string ls_FILED = ""; string ls_Value = ""; //----------------------------------------------------------------------------------------------------- group = null; string ls_rule = "SELECT RID,FILED,OID,CYCLE,STRING_S,STRING_E,STRING_NEW,INCLUDE_S,INCLUDE_E,STR_AREA,STR_AFT,STR_BEF FROM URL_RULE WHERE siteid=302 and STATUS=1"; group = DB.GetDataGroup(ls_rule); if (group.Table.Rows.Count > 0) { for (int j = 0; j < group.Table.Rows.Count; j++) { try { ls_Value = OperateStr_Adv(ls_shtml, group.Table.Rows[j]["STRING_S"].ToString(), group.Table.Rows[j]["STRING_E"].ToString(), "", 1, 0, 0, group.Table.Rows[j]["CYCLE"].ToString(), group.Table.Rows[j]["STR_AREA"].ToString(), group.Table.Rows[j]["STR_AFT"].ToString(), group.Table.Rows[j]["STR_BEF"].ToString()); ls_Value = NoHTML(ls_Value).Trim(); ls_Value = ls_Value.Replace("s128/", ""); //ls_Value = OperateStr(ls_shtml, group.Table.Rows[j]["STRING_S"].ToString(), group.Table.Rows[j]["STRING_E"].ToString(), "", 1, 0, 0, group.Table.Rows[j]["CYCLE"].ToString()); } catch { ls_Value = ""; } string ls_up = "UPDATE Photo_hongzilan_B2 SET " + group.Table.Rows[j]["FILED"].ToString() + "='" + ls_Value + "' ,STATUS=4 WHERE ID='" + group_html.Table.Rows[i]["ID"].ToString() + "'"; //string ls_up = "insert into pick_p2 (flag,pid,url_pic) values ('B','" + group_html.Table.Rows[i]["ID"].ToString() + "','" + ls_Value + "')"; DB.ExecuteSQL(ls_up); } } ls_shtml = null; group = null; //----------------------------------------------------------------------------------------------------- } } } catch { } MessageBox.Show("OK"); }
private void button31_Click(object sender, EventArgs e) { DataGroup group = new DataGroup(); DataGroup group_html = new DataGroup(); group_html = null; DataEntity de = new DataEntity(); de.RemoveAll(); group_html = null; string ls_sql = "SELECT ID,HTML FROM Photo_hongzilan_B1 WHERE status=2 order by ID"; group_html = DB.GetDataGroup(ls_sql); if (group_html.Table.Rows.Count > 0) { for (int i = 0; i < group_html.Table.Rows.Count; i++) { string ls_shtml = group_html.Table.Rows[i]["HTML"].ToString().Replace("\r\n", "").ToString(); //替换换行符 ls_shtml = ls_shtml.Replace("|", ""); //原先的“|”替换 ls_shtml = ls_shtml.Replace("\"", ""); //原先的“|”替换 ls_shtml = ls_shtml.Replace("<div><a href=", "|"); //将分隔码 替换成“|” string[] dog_small = ls_shtml.Split('|');//子串 int pd = 0; foreach (string bb in dog_small) { if (pd > 0) { string ls_FILED = ""; string ls_Value = ""; //----------------------------------------------------------------------------------------------------- group = null; string ls_rule = "SELECT RID,FILED,OID,CYCLE,STRING_S,STRING_E,STRING_NEW,INCLUDE_S,INCLUDE_E FROM URL_RULE WHERE siteid=301 and STATUS=1"; group = DB.GetDataGroup(ls_rule); if (group.Table.Rows.Count > 0) { for (int j = 0; j < group.Table.Rows.Count; j++) { try { ls_Value += ",'" + OperateStr(bb, group.Table.Rows[j]["STRING_S"].ToString(), group.Table.Rows[j]["STRING_E"].ToString(), "", 1, 0, 0, "0") + "'"; } catch { ls_Value = "," + " "; } ls_FILED += "," + group.Table.Rows[j]["FILED"].ToString(); } string ls_up = "INSERT INTO Photo_hongzilan_B2 (PID " + ls_FILED + ",STATUS) values ('" + group_html.Table.Rows[i]["ID"].ToString() + "' " + ls_Value + ",1)"; DB.ExecuteSQL(ls_up); ls_Value = ""; ls_FILED = ""; } group = null; //----------------------------------------------------------------------------------------------------- } pd += 1; } } MessageBox.Show("OK!!"); } }