Search code examples
c#sqlpowershelldatatablewritexml

DataTable WriteXml Float separator


quick question regarding a DataTable Function which I'm using.

I have a DataTables returned by a SQL stored procedure.

The StoredProcedure returns all fields as individual fieldtypes (string, int, float, datetimes)

quantity (float) 

STORED PROCEDURE:

BEGIN
    SELECT * FROM V_EXPORT_RAPPORTPOSITIONEN_MIT_ITEMID WHERE ID=@ItemID
END

Now I'm using this function in PowerShell

isesp_DataTableToXmlFile $exportFile $EntityName

Which is acutually just:

$global:DetailPosTable.TableName=[string]::Format("{0}detail",$EntityName);
$global:DetailPosTable.WriteXml($exportFileDetails);

Now the problem is that in my Table the float looks like: 3.5

And in my XML-File: 3,5

Even though I changed my region and language to Swiss-German an in the extended properties I set the decimal separator to "." it wont change it.

My question is if I can still try to use the WriteXml Method and check that it's exporting the decimal / float with a "." or if I have to loop through every row while adding it to the DataTable and change it's quantity ?


Solution

  • I just found out that the issue was actually turning on the setting:

    enter image description here

    But I also had to restart and reopen my script that it works with these changes...(which I honestly forgot to do).