如何自动备份数据库

问题描述:

大家好,



我真的需要你的帮助!



我在保存方面有些麻烦在我的系统中的数据,这已经发生了大约4次。我的问题是,每次用户在检查后保存一个病人的文件时,所有患者记录的所有预览数据都被输入的新数据替换。有没有办法每1或2小时备份所有数据,以便我可以检索预览记录,我已经有了每日备份。

提前谢谢!



这是保存数据的代码:



Hi guys,

I really need your help!

Im having some trouble in saving data in my system, this was happened about 4 times already. My problem is that every time the user save the files of one patient after the check-up all the previews data of all patient's record was being replaced by the new data inputted. Is there a way to backup all the data every 1 or 2 hours so I can retrieve the previews record, I already have the daily backup.
Thanks in advance!

here is my code in saving data:

SQL = "Insert into tbl_Main (Employee_ID, Employee_Name, Age, Sex, Division_Name, Department_Name, Section_Name, Position_Description, Appointment, CheckupDate, Findings, Recommendation, Illness, Status)" & _
 "VALUES ('" + Me.lblEmpID.Text.Trim + "', '" + Me.lblEmpName.Text.Trim + "', " + Me.lblAge.Text.Trim + ", " & _
    " '" + Me.lblSex.Text.Trim + "', '" + Me.lblDivision.Text.Trim + "', '" + Me.lblDepartment.Text.Trim + "', " & _
    " '" + Me.lblSection.Text.Trim + "', '" + Me.lblPosition.Text.Trim + "', '" + Me.lblAppointment.Text.Trim + "', " & _
    " '" + Me.dtCheckup.Text.Trim + "', '" + Me.cmbFindings.Text.Trim + "', '" & Me.txtRecommendations.Text.ToString & "', '" & Me.txtIllness.Text.ToString & "', 1)"

您可以创建批处理文件并使用Windows Scheduler来执行此操作

通过@EduardoMolteni在*中的以下链接中检查答案

SQL Server自动备份 [ ^ ]

如果您需要窗口中的日程安排任务帮助,请查看以下链接

使用Windows任务计划程序运行批处理文件 [ ^ ]



希望,这有助于:)
You can create a batch file and make use of Windows Scheduler to do this
Check the answer by @EduardoMolteni in the following link in *
SQL Server Automated Backups[^]
Check following link if you need assistance with scheduling task in windows
Run a batch file with Windows task scheduler[^]

Hope, that helps :)