' Do the backup of all tables Public Function Backup() As Boolean Dim lcDirectory As String = "" Dim lcTable As String = "" Dim lnCounter As Integer = 0 Dim loDataProvider As Framework.Framework.Data = New Framework.Framework.Data(oApp) Dim loDataProviderBackup As Framework.Framework.Data = New Framework.Framework.Data(oApp) Dim loRow As DataRow oOriginator.Status.Text = "Backup..." ' Get the directory lcDirectory = oApp.GetIni(oApp.cINIDirectory + oApp.cINIFile, "System", "Backup") lcDirectory = oApp.GetPath(lcDirectory) ' Copy the files If Not loDataProvider.SQLExec("SELECT Table.Table FROM Table ORDER BY Table.Table") Then Return False End If ' This is necessary as the framework is using a global connection. ' As we have Task.dbf in operation at this level as well as Table.dbf just above, we need ' to close the connection before proceeding. oApp.aConnection(1, 2).Close() oApp.aConnection(1, 2).Open() For lnCounter = 0 To loDataProvider.nCount - 1 loRow = loDataProvider.oDataSet.Tables("Temp").Rows(lnCounter) lcTable = Trim(loRow("Table")) oOriginator.Status.Text = "Copying " + lcTable + ".dbf " + _ (lnCounter + 1).ToString + " of " + loDataProvider.nCount.ToString + "..." loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""SET SAFETY OFF"")") loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""SET EXCLUSIVE OFF"")") loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""USE " + lcTable + """)") loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""COPY TO '" + lcDirectory + lcTable + "'"")") loDataProviderBackup.CommandTextAdd("EXECSCRIPT(""USE"")") ' Index If Not loDataProviderBackup.ExecuteNonQuery() Then Return False End If Next Return True End Function