Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / SqlClient / SqlError.cs / 1305376 / SqlError.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.SqlClient { using System; using System.Diagnostics; using System.Globalization; [Serializable] public sealed class SqlError { // bug fix - MDAC 48965 - missing source of exception // fixed by [....] private string source = TdsEnums.SQL_PROVIDER_NAME; private int number; private byte state; private byte errorClass; [System.Runtime.Serialization.OptionalFieldAttribute(VersionAdded=2)] private string server; private string message; private string procedure; private int lineNumber; internal SqlError(int infoNumber, byte errorState, byte errorClass, string server, string errorMessage, string procedure, int lineNumber) { this.number = infoNumber; this.state = errorState; this.errorClass = errorClass; this.server = server; this.message = errorMessage; this.procedure = procedure; this.lineNumber = lineNumber; if (errorClass != 0) { Bid.Trace("infoNumber=%d, errorState=%d, errorClass=%d, errorMessage='%ls', procedure='%ls', lineNumber=%d\n" , infoNumber, (int)errorState, (int)errorClass, errorMessage, procedure == null ? "None" : procedure, (int)lineNumber); } } // bug fix - MDAC #49280 - SqlError does not implement ToString(); // I did not include an exception stack because the correct exception stack is only available // on SqlException, and to obtain that the SqlError would have to have backpointers all the // way back to SqlException. If the user needs a call stack, they can obtain it on SqlException. public override string ToString() { //return this.GetType().ToString() + ": " + this.message; return typeof(SqlError).ToString() + ": " + this.message; // since this is sealed so we can change GetType to typeof } // bug fix - MDAC #48965 - missing source of exception // fixed by [....] public string Source { get { return this.source;} } public int Number { get { return this.number;} } public byte State { get { return this.state;} } public byte Class { get { return this.errorClass;} } public string Server { get { return this.server;} } public string Message { get { return this.message;} } public string Procedure { get { return this.procedure;} } public int LineNumber { get { return this.lineNumber;} } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.SqlClient { using System; using System.Diagnostics; using System.Globalization; [Serializable] public sealed class SqlError { // bug fix - MDAC 48965 - missing source of exception // fixed by [....] private string source = TdsEnums.SQL_PROVIDER_NAME; private int number; private byte state; private byte errorClass; [System.Runtime.Serialization.OptionalFieldAttribute(VersionAdded=2)] private string server; private string message; private string procedure; private int lineNumber; internal SqlError(int infoNumber, byte errorState, byte errorClass, string server, string errorMessage, string procedure, int lineNumber) { this.number = infoNumber; this.state = errorState; this.errorClass = errorClass; this.server = server; this.message = errorMessage; this.procedure = procedure; this.lineNumber = lineNumber; if (errorClass != 0) { Bid.Trace("infoNumber=%d, errorState=%d, errorClass=%d, errorMessage='%ls', procedure='%ls', lineNumber=%d\n" , infoNumber, (int)errorState, (int)errorClass, errorMessage, procedure == null ? "None" : procedure, (int)lineNumber); } } // bug fix - MDAC #49280 - SqlError does not implement ToString(); // I did not include an exception stack because the correct exception stack is only available // on SqlException, and to obtain that the SqlError would have to have backpointers all the // way back to SqlException. If the user needs a call stack, they can obtain it on SqlException. public override string ToString() { //return this.GetType().ToString() + ": " + this.message; return typeof(SqlError).ToString() + ": " + this.message; // since this is sealed so we can change GetType to typeof } // bug fix - MDAC #48965 - missing source of exception // fixed by [....] public string Source { get { return this.source;} } public int Number { get { return this.number;} } public byte State { get { return this.state;} } public byte Class { get { return this.errorClass;} } public string Server { get { return this.server;} } public string Message { get { return this.message;} } public string Procedure { get { return this.procedure;} } public int LineNumber { get { return this.lineNumber;} } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImageSourceValueSerializer.cs
- NotifyParentPropertyAttribute.cs
- TabPage.cs
- WorkflowIdleElement.cs
- X509CertificateClaimSet.cs
- MessageQueueInstaller.cs
- OdbcFactory.cs
- Matrix.cs
- HtmlInputText.cs
- _PooledStream.cs
- EventLogEntryCollection.cs
- EntityDesignerDataSourceView.cs
- UnmanagedMarshal.cs
- _SSPIWrapper.cs
- DomainUpDown.cs
- AspNetCacheProfileAttribute.cs
- Roles.cs
- EditorPartChrome.cs
- WinCategoryAttribute.cs
- ExtensionSimplifierMarkupObject.cs
- BackStopAuthenticationModule.cs
- TextEffect.cs
- Win32Interop.cs
- DataTableClearEvent.cs
- ValueQuery.cs
- ResourceType.cs
- AssemblyCache.cs
- BitmapCacheBrush.cs
- ComponentSerializationService.cs
- RuleSettingsCollection.cs
- C14NUtil.cs
- GeneralTransform2DTo3DTo2D.cs
- AuditLevel.cs
- SystemParameters.cs
- PriorityBinding.cs
- InputBindingCollection.cs
- Size3D.cs
- SecurityKeyIdentifier.cs
- FieldValue.cs
- SeverityFilter.cs
- CreateBookmarkScope.cs
- AudioStateChangedEventArgs.cs
- FileSystemWatcher.cs
- EmptyEnumerable.cs
- SemanticBasicElement.cs
- ErrorHandler.cs
- BitmapVisualManager.cs
- FormView.cs
- ImageAttributes.cs
- ObjectTokenCategory.cs
- SqlReferenceCollection.cs
- CreateUserErrorEventArgs.cs
- ObjectDataSourceFilteringEventArgs.cs
- ModelEditingScope.cs
- EventProviderWriter.cs
- WebPartCancelEventArgs.cs
- QilChoice.cs
- PKCS1MaskGenerationMethod.cs
- BooleanAnimationUsingKeyFrames.cs
- SmiContextFactory.cs
- ValidatedControlConverter.cs
- UnitControl.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- KeyValuePair.cs
- PropertyFilterAttribute.cs
- XmlReaderSettings.cs
- CompiledQueryCacheKey.cs
- SerializerProvider.cs
- Italic.cs
- FixedSOMContainer.cs
- ScaleTransform3D.cs
- BindingContext.cs
- EmptyControlCollection.cs
- UIElement3D.cs
- UseLicense.cs
- EncodingDataItem.cs
- GCHandleCookieTable.cs
- OdbcUtils.cs
- PluggableProtocol.cs
- Padding.cs
- XmlSchemaGroup.cs
- CheckedListBox.cs
- DataSysAttribute.cs
- WebHttpBehavior.cs
- FragmentQueryKB.cs
- ValidationHelper.cs
- OracleColumn.cs
- XmlReader.cs
- ExtentJoinTreeNode.cs
- RubberbandSelector.cs
- FormsIdentity.cs
- ObjectView.cs
- GridViewPageEventArgs.cs
- SapiRecoInterop.cs
- DateTime.cs
- _ContextAwareResult.cs
- ErasingStroke.cs
- TheQuery.cs
- TableLayout.cs
- ComponentGuaranteesAttribute.cs