private void Form1_Load(object sender, System.EventArgs e) { CAutoBackup cab = new CAutoBackup(); if (this.m_sCon == null) { cab.iniCon(); this.m_sCon = CAutoBackup.m_sCon; } else { CAutoBackup.m_sCon = this.m_sCon; } string strFileName = ""; cab.getFileName(ref strFileName); this.txtFileName.Text = strFileName; if (this.txtFileName.Text.Trim() == "") { this.chkAutoBack.Checked = false; } else { this.chkAutoBack.Checked = true; } }
//设置自动备份的路径 private bool setFileName() { try { CAutoBackup cab = new CAutoBackup(); string strErr = ""; if (cab.backUp(CAutoBackup.m_sCon.Database, this.txtFileName.Text.Trim(), ref strErr) == false) { return(false); } if (cab.bSetFileName(CAutoBackup.m_sCon.Database, this.txtFileName.Text.Trim()) == false) { return(false); } return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
private void execTime(string strName) { try { string strErr=""; string strFileName=""; if(strName=="backUp") { BengZhan.AutoBackup.CAutoBackup cab=new CAutoBackup(); cab.backUp(ref strErr,ref strFileName); } } catch(Exception ex) { MessageBox.Show(ex.ToString()); } }
private void autoBackup() { try { XmlDocument xDoc=new XmlDocument(); xDoc.Load("Server.xml"); string strCon=xDoc.DocumentElement.SelectSingleNode("./strCon").InnerText.Trim(); SqlConnection sConEx=new SqlConnection(strCon); sConEx.Open(); BengZhan.AutoBackup.CAutoBackup cab=new BengZhan.AutoBackup.CAutoBackup(); BengZhan.AutoBackup.CAutoBackup.m_sCon=sConEx; this.Cursor=Cursors.WaitCursor; cab.autoBackup(); this.Cursor=Cursors.Default; } catch(Exception ex) { this.Cursor=Cursors.Default; MessageBox.Show(ex.ToString()); } }
private void mnuDbUp_Click(object sender, System.EventArgs e) { XmlDocument xDoc=new XmlDocument(); xDoc.Load("Info.xml"); string strBUp=xDoc.DocumentElement.SelectSingleNode("./bUp").Attributes.GetNamedItem("val").Value.ToString().Trim(); if(strBUp=="false") { MessageBox.Show("�����ݿ�汾�Ѿ������£�����Ҫ������"); return; } CAutoBackup cab=new CAutoBackup(); cab.iniCon(); if(cab.executeSqlFile("delTable.sql")==true) { MessageBox.Show("������ɣ�"); } xDoc.DocumentElement.SelectSingleNode("./bUp").Attributes.GetNamedItem("val").Value="true"; xDoc.Save("info.xml"); }
//�����Զ����ݵ�·�� private bool setFileName() { try { CAutoBackup cab=new CAutoBackup(); string strErr=""; if(cab.backUp(CAutoBackup.m_sCon.Database,this.txtFileName.Text.Trim(),ref strErr)==false) { return false; } if(cab.bSetFileName(CAutoBackup.m_sCon.Database,this.txtFileName.Text.Trim())==false) { return false; } return true; } catch(Exception ex) { MessageBox.Show(ex.ToString()); return false; } }
private void Form1_Load(object sender, System.EventArgs e) { CAutoBackup cab=new CAutoBackup(); if(this.m_sCon==null) { cab.iniCon(); this.m_sCon=CAutoBackup.m_sCon; } else { CAutoBackup.m_sCon=this.m_sCon; } string strFileName=""; cab.getFileName(ref strFileName); this.txtFileName.Text=strFileName; if(this.txtFileName.Text.Trim()=="") { this.chkAutoBack.Checked=false; } else { this.chkAutoBack.Checked=true; } }