Пример #1
0
Файл: Form1.cs Проект: zhangvs/-
        private void button2_Click(object sender, EventArgs e)
        {
            string sql = "";

            for (int i = 0; i < 100; i++)
            {
                sql += ad("0539", i * 100, (i + 1) * 100);
            }
            string ss = sql.Substring(0, sql.Length - 10);

            SqlHelp.connStr = "Data Source=47.93.253.194;Initial Catalog=HZSoftFramework_Base_2016;User ID=sa;Password=system@123";
            DataTable returnDt = SqlHelp.bangding(ss);

            dataGridView1.DataSource = returnDt;
        }
Пример #2
0
        void mainWhile(object tel)
        {
            string    telStr   = tel.ToString();
            string    strSql   = "select SUBSTRING(Number7,1,3) q3w from TelphoneData where SUBSTRING(Number7,4,4)=" + telStr.Substring(3, 4) + " and city='" + textBox2.Text + "'";
            DataTable returnDt = SqlHelp.bangding(strSql);
            string    telStr8  = telStr.Substring(3, 8);

            for (int i = 0; i < returnDt.Rows.Count; i++)
            {
                string keyword = returnDt.Rows[i][0].ToString() + telStr8;
                int    bl      = CollectRule.MainWhile(search, keyword);
                if (bl == 1)
                {
                    num++;
                }
                else if (bl == -1)
                {
                    MessageBox.Show(DateTime.Now.ToString() + "执行到:" + keyword + "时,当前IP开始被" + search + "屏蔽,未启动VPN!\r\n");
                }
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //C:\Users\Administrator\Documents\Visual Studio 2015\Projects\号码采集系统\号码采集系统\bin\x86\Debug\20170914
            string spath = Environment.CurrentDirectory + "\\" + dateStr;

            if (!Directory.Exists(spath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(spath);
                directoryInfo.Create();
            }
            StringHelp.filePathOut = spath + "\\baidu手机万号采集_" + textBox2.Text.Trim() + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xls";
            StringHelp.pathError   = spath + "\\baidu手机万号采集_" + textBox2.Text.Trim() + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
            //创建excel文件
            StringHelp.CreateExcel();

            if (textBox1.Text.Trim() == "" || textBox2.Text.Trim() == "")
            {
                MessageBox.Show("城市或号段不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            dt          = DateTime.Now;
            label3.Text = dt + "正在执行……";
            z4Str       = textBox2.Text;

            ThreadPool.SetMaxThreads(4, 4); //设置最大线程数
            StringHelp.Write(StringHelp.pathError, DateTime.Now.ToString() + "\r\n--------------------------------" + textBox2.Text + "号段开始-------------------------------------" + "\r\n");

            string    strSql   = "select SUBSTRING(Number7,1,3) q3w from TelphoneData where SUBSTRING(Number7,4,4)=" + textBox2.Text.Trim() + " and city='" + textBox1.Text.Trim() + "' AND SUBSTRING(Number7,1,3) NOT IN ('170','171')";
            DataTable returnDt = SqlHelp.bangding(strSql);

            for (int i = 0; i < returnDt.Rows.Count; i++)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(mainWhile), returnDt.Rows[i][0].ToString());
            }

            //是否结束所有线程
            rhw = ThreadPool.RegisterWaitForSingleObject(new System.Threading.AutoResetEvent(false), CheckThreadPool, null, 5000, false);
        }