示例#1
0
        private void dataClearBtnTruncateAllTable_Click(object sender, EventArgs e)
        {
            BLLClear bllDataClear = new BLLClear(CommProp.ConnectionString);

            UIInProcess(true);

            try
            {
                if (SysMessageBox.ShowMessage("将会删除所有表,并收缩数据库。谨慎确认!!!", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    bllDataClear.OpenConnection();

                    // 删除所有表,并收缩数据库
                    bllDataClear.TruncateAllTable();

                    Console.WriteLine("任务完成!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                bllDataClear.CloseConnection();
            }

            UIInProcess(false);
        }
示例#2
0
        private void dataClearBtnStockHeadTruncate_Click(object sender, EventArgs e)
        {
            BLLClear bllDataClear = new BLLClear(CommProp.ConnectionString);

            UIInProcess(true);

            try
            {
                if (SysMessageBox.ShowMessage("清空代码表头,确认?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    bllDataClear.OpenConnection();
                    bllDataClear.TruncateStockHead();

                    Console.WriteLine("代码表头清空完成!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                bllDataClear.CloseConnection();
            }

            UIInProcess(false);
        }