日期:2014-05-19  浏览次数:20771 次

启动一个线程写入数据库 在写入数据库的时候可以终止此线程 急啊!请大家帮忙!
1.读取EXCEL   中的数据   然后启动一个线程写入数据库   在写入数据库的时候可以终止此线程,在第一次导入的时候是可以的   但是在导入终止先程的时候会出问题!   请大家帮忙看看哪里有问题!
2.想加个进度条   请问在什么事件的时候写!

  private   Thread   m_UpLoadDataThread;
  private   OleDbConnection   oleConnection;
  DataSet   m_DataSet   =   new   DataSet();
  ZhiLingInfo   info   =   new   ZhiLingInfo();

//导入按钮
void   toolStripButtonLaiLiaoBuLiang_Click(object   sender,   EventArgs   e)
{
                        CCursor.Current   =   Cursors.WaitCursor;

                        this.m_BindingList.Clear();

                        try
                        {
                                OpenFileDialog   dlg   =   new   OpenFileDialog();
                                dlg.Title   =   "导入来料不良信息 ";
                                dlg.Filter   =   "(*.xls)|*.xls ";
                                dlg.RestoreDirectory   =   true;

                               
                                if   (dlg.ShowDialog()   ==   DialogResult.OK)
                                {
                                        this.dataGridView.Refresh();

                                       
                                        #region   连接Excel
 
                                        string   strConnection   =   "Provider=Microsoft.Jet.OLEDB.4.0; "   +   "Data   Source   = "   +   dlg.FileName   +   ";Extended   Properties   =   Excel   8.0 ";

                                        oleConnection   =   new   OleDbConnection(strConnection);

                                        string   strCommondText   =   @ "SELECT     *   FROM   [返品信息导入$] ";