NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

SQLError Class

Collects information relevant to a warning or error returned by SQL Server.

Object
   SQLError

[Visual Basic]
Public Class SQLError
[C#]
public class SQLError
[C++]
public __gc class SQLError
[JScript]
public class SQLError

Remarks

This class is created by the adapter when an error occurs. An instance of SQLError is created and managed by the SQLErrors class, which in turn is created by the SQLException class.

Requirements

Namespace: System.Data.SQL

Assembly: System.Data.dll

Example [Visual Basic]

The following example displays the values of some of the SQLError properties in a window.

[Visual Basic]

Private Sub ShowAllSqlErrors()
   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)
      Dim SQLErr As New SQLError
      For Each SQLErr In SQLExcept.Errors
         ShowSQLError(SQLErr)
      Next
   End Try
End Sub
Private Sub ShowSQLError(sqlServerErr2 As SQLServerError)
   Dim myMessage As String
   Dim myTitle As String
   Dim myMsgBox As MessageBox
   myMessage = "Error " + sqlServerErr2.Number _
   + " on Server " + sqlServerErr2.Server + ": " _
   + sqlServerErr2.Message + " on Line " _
   + sqlServerErr2.LineNumber 
   myTitle  = "SQL Server Error"
   myMsgBox.Show myMessage, myTitle
End Sub

See Also

SQLError Members | System.Data.SQL Namespace | SQLErrors | SQLException