2 * @(#)SqlError.java 1.0 01/01/03
4 * Copyright 2002 Mainsoft Corporation. All Rights Reserved.
6 * This software is the proprietary information of Mainsoft Corporation.
7 * Use is subject to license terms.
11 namespace System.Data.SqlClient
13 using System.Data.ProviderBase;
15 using System.Data.Common;
18 * Collects information relevant to a warning or error returned by SQL Server.
20 * @author Pavel Sandler
21 * @version 1.0, 01/01/03
25 public class SqlError : AbstractDbError
27 string _serverVersion;
29 * Initialize SqlError object
31 internal SqlError(SQLException e, AbstractDBConnection connection) : base(e, connection)
33 if (connection != null)
34 _serverVersion = connection.ServerVersion;
38 * Overridden. Gets the complete text of the error message.
40 * @return A string representation of the current object.
42 public override String ToString()
44 return String.Concat("SqlError:", Message, _e.StackTrace);
48 * Gets the name of the provider that generated the error.
50 * @return The name of the provider
61 * Gets a number that identifies the type of error.
63 * @return Number of the error
74 * Gets a numeric error code from SQL Server that represents an error,
75 * warning or "no data found" message. For more information on how to
76 * decode these values, see SQL Server Books Online.
84 return 0; // & BitConstants.ALL_BYTE;
89 * Gets the severity level of the error returned from SQL Server.
91 * @return Severity level of the error
97 return 0; // & BitConstants.ALL_BYTE;
102 * Gets the name of the instance of SQL Server that generated the error.
104 * @return The name of the server
110 return _serverVersion;
115 * Gets the text describing the error.
117 * @return The text describing the error
119 public String Message
128 * Gets the name of the stored procedure or remote procedure call (RPC)
129 * that generated the error.
131 * @return The name of stored procedure that generated the error.
133 public String Procedure
142 * Bets the line number within the Transact-SQL command batch or stored
143 * procedure that contains the error.
145 * @return Line number of error in stored procedure
147 public int LineNumber