OdbcException.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // System.Data.Odbc.OdbcDataReader
  3. //
  4. // Author:
  5. // Brian Ritchie ([email protected])
  6. //
  7. // Copyright (C) Brian Ritchie, 2002
  8. //
  9. using System.Collections;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Data.Common;
  13. using System.Runtime.InteropServices;
  14. using System.Runtime.Serialization;
  15. namespace System.Data.Odbc
  16. {
  17. public sealed class OdbcException : SystemException
  18. {
  19. OdbcErrorCollection col;
  20. internal OdbcException(OdbcError Error) : base (Error.Message)
  21. {
  22. col=new OdbcErrorCollection();
  23. col.Add(Error);
  24. }
  25. public OdbcErrorCollection Errors
  26. {
  27. get
  28. {
  29. return col;
  30. }
  31. }
  32. public override string Source
  33. {
  34. get
  35. {
  36. return col[0].Source;
  37. }
  38. }
  39. public override string Message {
  40. get
  41. {
  42. return col[0].Message;
  43. }
  44. }
  45. #region Methods
  46. public override void GetObjectData (SerializationInfo si, StreamingContext context)
  47. {
  48. if (si == null)
  49. throw new ArgumentNullException ("si");
  50. si.AddValue ("col", col);
  51. base.GetObjectData (si, context);
  52. }
  53. #endregion // Methods
  54. }
  55. }