Adding Using statement, The Backup and Restore BAT files are now build with the database name you specified in the settings
This commit is contained in:
parent
21a5b9a05d
commit
671c3aa137
@ -108,8 +108,12 @@ namespace DataLoader
|
||||
//Format.UpdateFormats(_FmtAllPath, _GenmacAllPath);
|
||||
Format.UpdateFormats(frmMain.MySettings.FormatFolder, frmMain.MySettings.GenMacFolder);
|
||||
|
||||
Format baseFormat = Format.Get(1);
|
||||
sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");
|
||||
//Format baseFormat = Format.Get(1);
|
||||
//sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");
|
||||
using (Format baseFormat = Format.Get(1))
|
||||
{
|
||||
sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");
|
||||
}
|
||||
|
||||
// This is to test the vln Libraries
|
||||
List<Folder> lfldr = vlnDataPathFolders();
|
||||
|
@ -276,8 +276,8 @@ namespace DataLoader
|
||||
try
|
||||
{
|
||||
//TextConvert.ResetSpecialCharacters();
|
||||
System.Diagnostics.Process[] wordProcesses = WordDoc.WordProcesses;
|
||||
//MyFrmErrors.Clear();
|
||||
System.Diagnostics.Process[] wordProcesses = WordDoc.WordProcesses;
|
||||
if (!FormatsOnly && wordProcesses.Length > 0)
|
||||
{
|
||||
AddError("{0} copies of MS Word are running", wordProcesses.Length);
|
||||
@ -322,19 +322,22 @@ namespace DataLoader
|
||||
{
|
||||
TimeSpan ts = new TimeSpan();
|
||||
DocVersionInfoList vl = DocVersionInfoList.Get();
|
||||
DocVersion v = null;
|
||||
//DocVersion v = null;
|
||||
MyInfo = "Computer Name: " + SystemInformation.ComputerName.ToUpper();
|
||||
foreach (DocVersionInfo vi in vl)
|
||||
{
|
||||
if (!MySettings.OnlyThisSet || (vi.Title.ToUpper() == MySettings.ProcedureSetPath.ToUpper())) // is this the procedure set we want to convert?
|
||||
{
|
||||
v = DocVersion.Get(vi.VersionID);
|
||||
Status = "Load " + v.Title + " - " + v.Name;
|
||||
lblCurSetFolder.Text = v.Title;
|
||||
lblCurSetFolder.Visible = true;
|
||||
lblProcessing.Visible = true;
|
||||
MyInfo = "Data Set: " + v.Title;
|
||||
ts += ldr.MigrateDocVersion(v, true);
|
||||
using (DocVersion v = DocVersion.Get(vi.VersionID))
|
||||
{
|
||||
//v = DocVersion.Get(vi.VersionID);
|
||||
Status = "Load " + v.Title + " - " + v.Name;
|
||||
lblCurSetFolder.Text = v.Title;
|
||||
lblCurSetFolder.Visible = true;
|
||||
lblProcessing.Visible = true;
|
||||
MyInfo = "Data Set: " + v.Title;
|
||||
ts += ldr.MigrateDocVersion(v, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
string ConversionTime = string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
||||
@ -362,9 +365,9 @@ namespace DataLoader
|
||||
script=script.Replace("{DBName}", MySettings.DBName);
|
||||
script=script.Replace("{DBPath}", MySettings.DBPath);
|
||||
SQLScriptRunner ssr = new SQLScriptRunner(script, MySettings.ConnectionString.Replace("{DBName}", dbName));
|
||||
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
||||
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
||||
ssr.Run();
|
||||
Status = String.Format("Script '{0}' Complete", scriptName);
|
||||
Status = String.Format("Script '{0}' Complete", scriptName);
|
||||
}
|
||||
private void Backup(string suffix)
|
||||
{
|
||||
@ -652,15 +655,13 @@ namespace DataLoader
|
||||
string pause = "pause";
|
||||
string bckupFileName = MySettings.BackupFileName;
|
||||
if (!bckupFileName.EndsWith(".bak")) bckupFileName += ".bak";
|
||||
string backupPath = MySettings.LogFilePath + @"\" + bckupFileName;
|
||||
string bckupcmd = "sqlcmd -E -S.\\sqlexpress -Q \"backup database [VEPROMS] to disk = '" + backupPath + "'\"";
|
||||
string rstorecmd = "sqlcmd -E -S.\\sqlexpress -Q \"restore database [VEPROMS] from disk = '" + backupPath + "'\"";
|
||||
//StreamWriter fsbackup = new StreamWriter(_LogFilePath + @"\BackupVEPROMS.bat");
|
||||
string backupPath = MySettings.LogFilePath + @"\" + bckupFileName + "'\"";
|
||||
string bckupcmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"backup database [{0}] to disk = '{1}",MySettings.DBName,backupPath);
|
||||
string rstorecmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"restore database [{0}] from disk = '{1}",MySettings.DBName,backupPath);
|
||||
StreamWriter fsbackup = new StreamWriter(MySettings.LogFilePath + @"\Backup" + bckupFileName.Substring(0,bckupFileName.Length-4) + ".bat");
|
||||
fsbackup.WriteLine(bckupcmd);
|
||||
fsbackup.WriteLine(pause);
|
||||
fsbackup.Close();
|
||||
//StreamWriter fsrestore = new StreamWriter(_LogFilePath + @"\RestoreVEPROMS.bat");
|
||||
StreamWriter fsrestore = new StreamWriter(MySettings.LogFilePath + @"\Restore" + bckupFileName.Substring(0,bckupFileName.Length-4) + ".bat");
|
||||
fsrestore.WriteLine(rstorecmd);
|
||||
fsrestore.WriteLine(pause);
|
||||
|
Loading…
x
Reference in New Issue
Block a user