Public Overloads Function RunSql(ByVal sSql As String, ByVal sTableName As String) As DataSet Dim oCmd As SqlCommand = New SqlCommand() Dim oCn As SqlConnection = Nothing Dim oDa As SqlDataAdapter = New SqlDataAdapter() Dim oDs As DataSet = New DataSet() oCn = Connect() With oCmd .Connection = oCn .CommandText = sSql .CommandType = CommandType.Text End With Try '//-------------begin trap*********************************** With oDa .SelectCommand = oCmd .Fill(oDs, sTableName) End With Catch objException As SqlException Dim objError As SqlError Dim objLog As EventLog If Not EventLog.SourceExists("myApp") Then EventLog.CreateEventSource("myApp", "Application") End If objLog = New EventLog() objLog.Source = "myApp" For Each objError In objException.Errors objLog.WriteEntry(objError.Message, EventLogEntryType.Information) Next End Try '//---------end trap***************************************** Disconnect(oCn) Return oDs End Function>>The exception has a Message property.