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)

'Declaration
Public MustOverride Property SourceColumnNullMapping As Boolean
'Usage
Dim instance As DbParameter
Dim value As Boolean

value = instance.SourceColumnNullMapping

instance.SourceColumnNullMapping = value
/** @property */
public abstract boolean get_SourceColumnNullMapping ()

/** @property */
public abstract void set_SourceColumnNullMapping (boolean value)

public abstract function get SourceColumnNullMapping () : boolean

public abstract function set SourceColumnNullMapping (value : boolean)

Not applicable.

Property Value

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.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2014 Microsoft