using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Configuration; using System.Data.SqlClient; using System.Threading; using System.Text.RegularExpressions; using System.IO; namespace HIPIS_PREG { public partial class Form1 : Form { private Thread preg;//线程名 private bool tureOfalse;//线程执行标识 public bool conYes;//连接服务成功失败标识 private bool one = false;//退出程序标识 string strdbHipis = System.Configuration.ConfigurationManager.AppSettings["dbHipis"].ToString();//源数据库 string strdbPreg = System.Configuration.ConfigurationManager.AppSettings["dbPreg"].ToString();//目标数据库 public Form1() { InitializeComponent(); //委托 InitTrayIcon();//图标托盘委托 Control.CheckForIllegalCrossThreadCalls = false;//线程委托 this.FormClosing += new FormClosingEventHandler(form_Closing);//退出程序委托 } private void Form1_Load(object sender, EventArgs e) { } //图标声明 NotifyIcon trayIcon = new NotifyIcon(); //图标路径 private Icon mNetTrayIcon = new Icon("../IMG/preg.ico"); //线程开始 private void btStart_Click(object sender, EventArgs e) { tureOfalse = true; preg = new Thread(new ThreadStart(PREG)); preg.Start(); btStart.Enabled = false; btStop.Enabled = true; } //线程方法 private void PREG() { do { label4.Text = "正在连接数据库... ...!"; ISopenCon(); } while (!conYes); DoWork_select(); label4.Text = "连接目标数据库成功!"; } //线程停止 private void btStop_Click(object sender, EventArgs e) { tureOfalse = false; preg.Abort(); this.label4.Text = "待同步... ..."; //控件显示隐藏 btStart.Enabled = true; btStop.Enabled = false; } ///
/// 连接目标数据库失败将信息写入LOG /// ///
///
private void fslog(Ex...