diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs index e716d232..110e45be 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs @@ -168,7 +168,7 @@ public static string DBServer else _Methods[str]++; } - if (_VEPROMS_Connection != null ) // Use Lazy Load + if (_VEPROMS_Connection != null) // Use Lazy Load { return _VEPROMS_Connection; } @@ -184,6 +184,8 @@ public static string DBServer // If we are using the DBConnection.xml file, // Check to see if "{MENU}" is being used and if a database was specified (ex."VEPROMS.EXE \DB=VEPROMS_xxx") // If both conditions are true, then call the ChooseDatabases() funtion which will return a valid connection string (we hope) + // Else Check to see if "{DB} is being used and if a database was specified (ex."VEPROMS.EXE \DB=VEPROMS_xxx") + // if both conditons are true, then replace "{DB}" in the connection string with the specified database (_selectedDatabase) without bring up the menu of database // otherwise use the connection string as it is in the DBConnection.xml if (xn != null) { @@ -193,6 +195,13 @@ public static string DBServer { constr1 = ChooseDatabase(constr1); } + else if (constr1.Contains("{DB}")) + { + if (SelectedDatabase != null) + constr1 = constr1.Replace("{DB}", _SelectedDatabase); + else + System.Windows.Forms.MessageBox.Show("A Command Line Switch is required to specify the database.\n\nFor example, where VEPROMSdata is the SQL database name:\n\n /DB=VEPROMSdata", "Cannot Find Database"); + } return _VEPROMS_Connection = constr1; } @@ -208,6 +217,13 @@ public static string DBServer { constr = ChooseDatabase(constr); } + else if (constr.Contains("{DB}")) + { + if (SelectedDatabase != null) + constr = constr.Replace("{DB}", _SelectedDatabase); + else + System.Windows.Forms.MessageBox.Show("A Command Line Switch is required to specify the database.\n\nFor example, where VEPROMSdata is the SQL database name:\n\n /DB=VEPROMSdata", "Cannot Find Database"); + } return _VEPROMS_Connection = constr; } set { _VEPROMS_Connection = value; }