Export (0) Print
Expand All

DbParameter::SourceColumnNullMapping Property

Sets or gets a value which indicates whether the source column is nullable. This allows DbCommandBuilder to correctly generate Update statements for nullable columns.

Namespace:  System.Data.Common
Assembly:  System.Data (in System.Data.dll)

public:
virtual property bool SourceColumnNullMapping {
	bool get () abstract;
	void set (bool value) abstract;
}

Property Value

Type: System::Boolean
true if the source column is nullable; false if it is not.

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 (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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft