ExtensionConvertDateFromSQL Method |  |
Convert SQL date include value null
Namespace:
Velo.Data.Helper
Assembly:
Velo.Data (in Velo.Data.dll) Version: 22.2.10.1 (22.2.10.450)
Syntaxpublic static Nullable<DateTime> ConvertDateFromSQL(
this Object pDate
)
<ExtensionAttribute>
Public Shared Function ConvertDateFromSQL (
pDate As Object
) As Nullable(Of DateTime)
Parameters
- pDate
- Type: SystemObject
Return Value
Type:
NullableDateTimeA date or null
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
Examples
This example get a date from a data reader.
Important: use method GetValue from data reader not method GetDateTime because method GetDateTime handling a SQL null not a system null.
this.DatePurchase = pDataRecord.GetValue(pDataRecord.GetOrdinal("DatePurchase")).ConvertDateFromSQL();
See Also