diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs
index 9429e79a..70efd85d 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/Database.cs
@@ -260,9 +260,9 @@ namespace VEPROMS.CSLA.Library
{
string strConn = VEPROMS_Connection; // If failure - Fail (Don't try to catch)
// Attempt to make a connection
+ SqlConnection cn = new SqlConnection(strConn);
try
{
- SqlConnection cn = new SqlConnection(strConn);
cn.Open();
return cn;
}
@@ -289,6 +289,8 @@ namespace VEPROMS.CSLA.Library
}
else
{
+ Open a MesageBox so the user is given some feedback that the connection has failed.
+ ReportInnermostException(exsql,strConn);
throw new ApplicationException("Failure on Connect", exsql);
}
}
@@ -299,6 +301,20 @@ namespace VEPROMS.CSLA.Library
}
}
}
+ ///
+ /// Open a MessageBox with the exception type, the connection string and the exception message
+ ///
+ /// exception being processed
+ /// connection string
+ private static void ReportInnermostException(Exception ex, string conn)
+ {
+ // walk up the exception stack to find the innermost exception.
+ while (ex.InnerException != null)
+ ex = ex.InnerException;
+ System.Windows.Forms.MessageBox.Show(string.Format("{0}\r\n\r\nConnection String ={1}", ex.Message,conn)
+ ,"PROMS - " + ex.GetType().FullName, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
+ System.Diagnostics.Process.GetCurrentProcess().Kill();
+ }
public static void PurgeData()
{
try