[System.Data] move to corefx (#4893)
[mono-project.git] / mcs / class / System.Data / corefx / SqlException.cs
blob5509434e49d0e7b334d6b44a227d10b9eeb697d8
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System;
6 using System.Text;
8 namespace System.Data.SqlClient
10 partial class SqlException
12 private const string DEF_MESSAGE = "SQL Exception has occured.";
14 public override string Message {
15 get {
16 if (Errors.Count == 0)
17 return base.Message;
18 StringBuilder result = new StringBuilder ();
19 if (base.Message != DEF_MESSAGE) {
20 result.Append (base.Message);
21 result.Append ("\n");
23 for (int i = 0; i < Errors.Count -1; i++) {
24 result.Append (Errors [i].Message);
25 result.Append ("\n");
27 result.Append (Errors [Errors.Count - 1].Message);
28 return result.ToString ();