-
-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Description
Warren -
Just noticed this when working with RVTools data from Excel and importing it to a database. Have some empty columns that are adding as empty strings in the DB instead of NULL.
Here is the line I modified to add a DBNULL value instead of an empty string.
if ($property.GetType().IsArray)
{
$DR.Item($Name) = $Value | ConvertTo-XML -As String -NoTypeInformation -Depth 1
}
elseif($Value -eq $null)
{
$DR.Item($Name) = [DBNull]::Value
}
else
{
$DR.Item($Name) = $Value
}
Change to: elseif($Value -eq $null -or $Value -eq "")
if ($property.GetType().IsArray)
{
$DR.Item($Name) = $Value | ConvertTo-XML -As String -NoTypeInformation -Depth 1
}
elseif($Value -eq $null -or $Value -eq "")
{
$DR.Item($Name) = [DBNull]::Value
}
else
{
$DR.Item($Name) = $Value
}
Metadata
Metadata
Assignees
Labels
No labels