SqlExceptionclass is created whenever the .NET Framework Data Provider for SQL Server encounters an error generated from the server. (Client side errors are thrown as standard common language runtime exceptions.) SqlException always contains at least one instance of SqlError.
System.Diagnostics.EventLog log = new System.Diagnostics.EventLog(); log.Source = "My Application"; log.WriteEntry(errorMessages); Console.WriteLine("An exception occurred. Please contact your system administrator."); }
If you have the better answer, then send it to us. We will display your answer after the approval.