2 // System.Data.OleDb.OleDbException
\r
5 // Konstantin Triger <kostat@mainsoft.com>
6 // Boris Kirzner <borisk@mainsoft.com>
8 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 namespace System.Data.OleDb
\r
39 using System.Data.Common;
\r
40 using System.Data.ProviderBase;
\r
43 * CURRENT LIMITATIONS
\r
44 * 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc)
\r
46 * 2. Method "void GetObjectData(...,...)" is not supported (serialization)
\r
49 public sealed class OleDbException : AbstractDbException
\r
51 internal OleDbException (Exception cause, OleDbConnection connection) : base (cause, connection) { }
\r
53 internal OleDbException (SQLException cause, OleDbConnection connection) : base (cause, connection) { }
\r
55 internal OleDbException (string message, SQLException cause, OleDbConnection connection) : base (message, cause, connection) { }
\r
57 protected override AbstractDbErrorCollection DbErrors {
\r
63 public OleDbErrorCollection Errors {
\r
65 return new OleDbErrorCollection (_cause, _connection);
\r
69 public override int ErrorCode {
\r
76 public sealed class OleDbException : System.Runtime.InteropServices.ExternalException
\r
78 private class OleDbExceptionImpl : AbstractDbException {
\r
79 internal OleDbExceptionImpl(Exception cause, OleDbConnection connection) : base(cause, connection) {}
\r
81 internal OleDbExceptionImpl(SQLException cause, OleDbConnection connection) : base(cause, connection) {}
\r
83 internal OleDbExceptionImpl(string message, SQLException cause, OleDbConnection connection) : base(message, cause, connection) {}
\r
85 protected override AbstractDbErrorCollection DbErrors {
\r
91 public OleDbErrorCollection Errors {
\r
93 return new OleDbErrorCollection(_cause, _connection);
\r
97 public int ErrorCode {
\r
104 OleDbExceptionImpl _impl;
\r
106 internal OleDbException(Exception cause, OleDbConnection connection) : base(null, cause) {
\r
107 _impl = new OleDbExceptionImpl(cause, connection);
\r
110 internal OleDbException(SQLException cause, OleDbConnection connection) : base(null, cause) {
\r
111 _impl = new OleDbExceptionImpl(cause, connection);
\r
114 internal OleDbException(string message, SQLException cause, OleDbConnection connection) : base(null, cause) {
\r
115 _impl = new OleDbExceptionImpl(message, cause, connection);
\r
118 * Gets a collection of one or more SqlError objects that give detailed
\r
119 * information about exceptions generated by the SQL Server .NET Data Provider.
\r
120 * @return collection of SqlError objects
\r
122 public OleDbErrorCollection Errors
\r
126 return (OleDbErrorCollection)_impl.Errors;
\r
131 * Gets the error code of the error.
\r
132 * @return The error code of the error.
\r
134 public override int ErrorCode
\r
138 return base.HResult;
\r
144 * Gets the name of the OLE DB provider that generated the error.
\r
145 * @return the name of the OLE DB provider that generated the error.
\r
147 public override String Source
\r
151 return _impl.Source;
\r
155 public override string Message {
\r
157 return _impl.Message;
\r