OdbcParameter.SourceColumnNullMapping Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value which indicates whether the source column is nullable. This lets DbCommandBuilder correctly generate Update statements for nullable columns.
public:
virtual property bool SourceColumnNullMapping { bool get(); void set(bool value); };
public override bool SourceColumnNullMapping { get; set; }
member this.SourceColumnNullMapping : bool with get, set
Public Overrides Property SourceColumnNullMapping As Boolean
Property Value
true
if the source column is nullable; false
if it is not.
Remarks
SourceColumnNullMapping is used by the DbCommandBuilder to correctly generate update commands when dealing with nullable columns. Generally, use of SourceColumnNullMapping is limited to developers inheriting from DbCommandBuilder.
DbCommandBuilder uses this property to determine whether the source column is nullable, and sets this property to true
if it is nullable, and false
if it is not. When DbCommandBuilder is generating its Update statement, it examines the SourceColumnNullMapping for each parameter. If the property is true
, DbCommandBuilder generates a WHERE clauses like the following example. In this query expression, "FieldName" represents the name of the field:
((@IsNull_FieldName = 1 AND FieldName IS NULL) OR
(FieldName = @Original_FieldName))
If SourceColumnNullMapping for the field is false, DbCommandBuilder generates the following WHERE clause:
FieldName = @OriginalFieldName
In addition, @IsNull_FieldName contains 1 if the source field contains null, and 0 if it does not. This mechanism allows for a performance optimization in SQL Server, and provides for common code that works across multiple providers.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기