fix for issue that decimal number are exported to excel as strings (#1425)

* fix export to excel issue with decimals

* add comment
This commit is contained in:
Alan Ren
2022-03-14 11:28:16 -07:00
committed by GitHub
parent aa97389d8e
commit cc5cb4066b

View File

@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IO;
using System.IO.Compression;
using System.Xml;
@@ -174,9 +175,16 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage
if (o is TimeSpan) //TimeSpan doesn't have TypeCode
{
AddCell((TimeSpan)o);
break;
}
AddCell(dbCellValue.DisplayValue);
// We need to handle SqlDecimal and SqlMoney types here because we can't convert them to .NET types due to different precisons in SQL Server and .NET.
else if (o is SqlDecimal || o is SqlMoney)
{
AddCellBoxedNumber(dbCellValue.DisplayValue);
}
else
{
AddCell(dbCellValue.DisplayValue);
}
break;
}
}