Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Data / System / Data / SqlClient / SqlError.cs / 1 / SqlError.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data.SqlClient {
using System;
using System.Diagnostics;
using System.Globalization;
[Serializable]
#if WINFSInternalOnly
internal
#else
public
#endif
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]
#if WINFSInternalOnly
internal
#else
public
#endif
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
- DataGridViewComboBoxColumn.cs
- CustomCredentialPolicy.cs
- WsdlBuildProvider.cs
- Page.cs
- ResourceReferenceExpressionConverter.cs
- StyleXamlParser.cs
- MachineKeyConverter.cs
- VisualCollection.cs
- ServiceNameElementCollection.cs
- HtmlProps.cs
- CultureTable.cs
- ResolveCriteria11.cs
- BitmapEffectCollection.cs
- ColumnHeaderConverter.cs
- DynamicDataExtensions.cs
- NameValueCollection.cs
- EntityViewContainer.cs
- DownloadProgressEventArgs.cs
- ObjectConverter.cs
- Merger.cs
- ContractSearchPattern.cs
- IxmlLineInfo.cs
- NativeMethods.cs
- RequestContextBase.cs
- _SSPIWrapper.cs
- PrivilegedConfigurationManager.cs
- ScriptMethodAttribute.cs
- SqlDataSourceSelectingEventArgs.cs
- ValidationEventArgs.cs
- SymbolDocumentInfo.cs
- Path.cs
- BuildProvider.cs
- ProtectedConfigurationProviderCollection.cs
- DockPattern.cs
- SqlErrorCollection.cs
- Crc32.cs
- SizeConverter.cs
- SingleTagSectionHandler.cs
- ButtonStandardAdapter.cs
- GifBitmapDecoder.cs
- DataListItemCollection.cs
- ComAdminInterfaces.cs
- SchemaConstraints.cs
- XmlFormatWriterGenerator.cs
- DBCommandBuilder.cs
- XmlEntity.cs
- WindowsStartMenu.cs
- CompilerState.cs
- Triplet.cs
- SqlDataReaderSmi.cs
- PeerChannelFactory.cs
- CommandHelper.cs
- ListDesigner.cs
- DataGridColumnEventArgs.cs
- GeneratedView.cs
- ButtonFieldBase.cs
- WorkflowValidationFailedException.cs
- DataObject.cs
- XmlReflectionMember.cs
- Stream.cs
- SkewTransform.cs
- DbMetaDataColumnNames.cs
- Focus.cs
- CanExpandCollapseAllConverter.cs
- HtmlElementErrorEventArgs.cs
- AuthenticationSection.cs
- DataTableTypeConverter.cs
- TerminateSequence.cs
- versioninfo.cs
- SettingsContext.cs
- TableLayoutSettingsTypeConverter.cs
- NativeCppClassAttribute.cs
- DataFieldConverter.cs
- BoundPropertyEntry.cs
- Queue.cs
- CollectionConverter.cs
- LongValidator.cs
- ReadOnlyObservableCollection.cs
- TerminatorSinks.cs
- MarkupProperty.cs
- TabControlToolboxItem.cs
- _NetworkingPerfCounters.cs
- SamlSubjectStatement.cs
- ClonableStack.cs
- EncoderExceptionFallback.cs
- DataGridViewSelectedColumnCollection.cs
- CodeExporter.cs
- PeerCollaborationPermission.cs
- TypeNameConverter.cs
- CodeVariableReferenceExpression.cs
- ping.cs
- XmlWriterSettings.cs
- X509UI.cs
- XmlSerializer.cs
- WebPartEditorOkVerb.cs
- RemoveStoryboard.cs
- SystemInformation.cs
- OverflowException.cs
- ProtocolViolationException.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs