基本信息
源码名称:将txt文件内容读入mysql数据库
源码大小:12.51M
文件格式:.rar
开发语言:C#
更新时间:2015-06-16
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using MySql.Data.MySqlClient.Authentication;

namespace Mysql
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            StreamReader objReader = new StreamReader("F:\\yahoopassword.txt");
            string sLine = "";
            ArrayList arrText = new ArrayList();


            while (sLine != null)
            {
                sLine = objReader.ReadLine();
                if (sLine != null)
                    arrText.Add(sLine);
            }
            objReader.Close();

            foreach (string sOutput in arrText)
            {
                richTextBox1.Text  = sOutput   "\n";

            }
                string Text = richTextBox1.Text;
                char[] delimiterChars = {'\n' };
                string[] words = Text.Split(delimiterChars);
                string constr = "server=127.0.0.2;User Id=root;Database=mydb";
                MySqlConnection mycon = new MySqlConnection(constr);
                mycon.Open(); //连接数据库
            for (int i = 0; i < 29700; i  )
            {
                try
                {
                    richTextBox2.Text  = words[i]   "\n";
                    int j = i   5;
                    MySqlCommand mycmdss = new MySqlCommand("UPDATE `mydb`.`email_addressee` SET `password`='" words[i] "' WHERE `ID`='" j "'", mycon);
                    //插入式修改表名,列名
                    mycmdss.ExecuteNonQuery();
                }
                catch (Exception w)
                {

                    MessageBox.Show(w.Message);
                }
               
            }
       
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string constr = "server=127.0.0.2;User Id=root;Database=mydb";
            MySqlConnection mycon = new MySqlConnection(constr);
            mycon.Open(); //连接数据库
            MySqlCommand mycmdss = new MySqlCommand("DELETE FROM `mydb`.`rmt_mail_buyer` WHERE `legality`='0'", mycon);
            mycmdss.ExecuteNonQuery();
        }

        private void button3_Click(object sender, EventArgs e)
        {
        }
    }
}