Collects all errors generated by the SQL Server adapter.
Object
SQLErrors
[Visual Basic] Public Class SQLErrors Implements ICollection, IEnumerable [C#] public class SQLErrors : ICollection, IEnumerable [C++] public __gc class SQLErrors : public ICollection, IEnumerable [JScript] public class SQLErrors implements ICollection, IEnumerable
This class is created by SQLException to collect instances of the SQLError class. SQLErrors always contains at least one instance of the SQLError class.
Namespace: System.Data.SQL
Assembly: System.Data.dll
The following example displays the values of some of the properties of the SQLError instances created and managed by the SQLErrors class.
[Visual Basic]
Private Sub GetSQLErrors() Dim myConnection As String Dim mySelect As String Dim dataSet As New DataSet Dim sqlDataSetComm As New SQLDataSetCommand myConnection = "user id=sa;password=;database=northwind;" _ + "server=mySQL;" mySelect = "SELECT * FROM Categories ORDER BY CategoryID" Try Set sqlDataSetComm = SQLDataSetCommand(mySelect, myConnection) sqlDataSetComm.FillDataSet(dataSet) Catch (SQLException SQLExcept) ShowSQLErrors(SQLExcept.Errors) End Try End Sub Private Sub ShowSQLErrors(sqlServerErrColl As SQLServerErrors) Dim myMessage As String Dim myTitle As String Dim myMsgBox As MessageBox Dim sqlServerErr As New SQLServerError myTitle = "SQL Server Error" For Each sqlServerErr In sqlServerErrColl myMessage = "Error " + sqlServerErr.Number _ + " on Server " + sqlServerErr.Server + ": " _ + sqlServerErr.Message + " on Line " _ + sqlServerErr.LineNumber myMsgBox.Show myMessage, myTitle Next End Sub
SQLErrors Members | System.Data.SQL Namespace | SQLError | SQLException