Example #1
0
        /// <summary>
        /// 同步数据到备份表
        /// </summary>
        public void SyncDataToBakTable(string edtime)
        {
            //获取备份表
            string tbName  = configM.TbName;
            string bkName  = tbName + ICL.STR_TB_BAK;
            string timefld = configM.Timefld;
            string pkfld   = configM.getTablePkFld();
            string cont    = timefld + "<='" + edtime + "'";;
            string bgtime  = DBTools.GetMaxBakBgTime(bkName, timefld);

            if (!string.IsNullOrEmpty(bgtime))
            {
                cont += " and " + timefld + ">='" + bgtime + "'";
            }
            cont += " and isnull(" + timefld + ",'')<>''";
            string fld = configM.getDBFlds();

            DBTools.WriteRecordToBakTable(bkName, tbName, cont, pkfld, fld);
        }
        /// <summary>
        /// 点击按钮自动更新数据到备份表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Modify_data_Click(object sender, EventArgs e)
        {
            if (!checkConfigFLDInfo())
            {
                //MessageBox.Show("请先获取配置信息!");
                return;
            }
            string tbName  = configM.TbName;
            string bkName  = tbName + ICL.STR_TB_BAK;
            string timefld = configM.Timefld;
            string pkfld   = configM.getTablePkFld();
            string cont    = timefld + "<='" + Tools.Now() + "'";
            string bgtime  = DBTools.GetMaxBakBgTime(bkName, timefld);

            if (!string.IsNullOrEmpty(bgtime))
            {
                cont += " and " + timefld + ">='" + bgtime + "'";
            }
            string fld = configM.getDBFlds();

            DBTools.WriteRecordToBakTable(bkName, tbName, cont, pkfld, fld);
        }