Added logic to use “{DB}” as the connection Initial Catalog setting which will be replaced with the specified database name from the \DB command line switch
This commit is contained in:
parent
0245c9fe7a
commit
1ba918cfd8
@ -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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user