示例#1
0
 private void btnSet_Click(object sender, EventArgs e)
 {
     int successNum = 0;
     string outFile = parameter.OutSite.ToString() + "cjrzlbb" + this.tbDate.Text.ToString() + ".dbf";
     if (File.Exists(outFile))
     {
         DialogResult eMsg = MessageBox.Show("DBF文件已存在,是否覆盖?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
         if (eMsg == DialogResult.Cancel)
         {
             eMsg = MessageBox.Show("操作取消!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             try
             {
                 outDBF = new CDBF(outFile);
                 outDBF.ClearDBF(outFile, finalTable);
                 successNum = outDBF.ExportDBF(outFile, finalTable);
                 this.logBox.Items.Add(outFile.ToString() + " Created, It has " + successNum.ToString() + " records!");
             }
             catch (Exception ex)
             {
                 eMsg = MessageBox.Show("DBF生成异常!ERROR:" + ex.ToString(), "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         try
         {
             outDBF = new CDBF(outFile);
             outDBF.CreateDBF(outFile, finalTable);
             successNum = outDBF.ExportDBF(outFile, finalTable);
             this.logBox.Items.Add(outFile.ToString() + " Created, It has " + successNum.ToString() + " records!");
         }
         catch (Exception ex)
         {
             DialogResult eMsg = MessageBox.Show("DBF生成异常!ERROR:" + ex.ToString(), "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
示例#2
0
 private void btnGet_Click(object sender, EventArgs e)
 {
     DataTable dt = new DataTable();
     num = 0;
     finalTable.Clear();
     if (this.tbDate.Text != null)
     {
         GetPath(this.tbDate.Text.ToString());
         for (int i = 0; i < num; i++)
         {
             int successNum = 0;
             if (!File.Exists(dbfFile[i]))
             {
                 this.logBox.Items.Add(dbfFile[i] + " -- File not exists!");
             }
             else
             {
                 dt.Clear();
                 dbf = new CDBF(dbfFile[i]);
                 dt = dbf.DBFQuery(@"select * from " + dbfFile[i]);
                 successNum = dbf.ImportDBF(finalTable, dt);
                 //finalTable.Merge(dt);
                 this.logBox.Items.Add(dbfFile[i] + " -- Update " + successNum.ToString() + "/" + dt.Rows.Count.ToString() + " records!");
             }
         }
         this.dgv_File.DataSource = finalTable;
     }
     else
     {
         DialogResult eMsg = MessageBox.Show("日期填写异常,请重新填写后再次操作!","错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }