September 20, 2021 at 12:13 pm
I picked 2 fields in the table and it displayed them:
System.Data.DataRow
11-371517-582-3-02 2VAK
September 20, 2021 at 12:49 pm
I picked 2 fields in the table and it displayed them:
System.Data.DataRow 11-371517-582-3-02 2VAK
Well, it displayed one of them. It is telling you that one of the "fields" is a System.Data.DataRow object which needs to be expanded. Here's a page about this: https://newbedev.com/extract-data-from-system-data-datarow-in-powershell
Ultimately you have to get to a place where you are able to output the data that you are expecting to see rather than an indicator of an object, as above. Once you are at that point then you can write it out.
September 20, 2021 at 1:57 pm
It produced 2 fields from the select
11-371517-582-3-02 1st value
2VAK 2nd value.
Sorry I guess I'm confused.
Thx.
So the issue is still that your evaluation is saying you have no rows? Or is is something else? If the former have a look at the answers on the following page and see if they help. Failing that, do an internet search for working with sql data in powershell and the System.Data.DataRow object class.
https://stackoverflow.com/questions/15395510/returning-a-row-count-for-a-datarow-in-powershell
September 20, 2021 at 2:22 pm
Correct in original script... It falls thru to:
# Message stating no data to export.
Write-Host "There is no data to export."
Thanks.
September 20, 2021 at 6:40 pm
Okay got it working from the links:
Used:
if ($items -ne $null)
Now I have output...
Thanks Again!!!!
October 20, 2021 at 11:54 pm
When It creates the XML output how can I get the encoding to be utf-8?
This is all I'm seeing at the TOP:
<?xml version="1.0"?>
Thx.
October 21, 2021 at 8:29 am
You need to specify your encoding, at the moment you are encoding using $Null. So change this:
# Create the XML file.
$xmlWriter = New-Object System.XMl.XmlTextWriter($fullFilePath,$Null)
To this:
# Create the XML file.
$encoding = [System.Text.Encoding]::UTF8
$xmlWriter = New-Object System.XMl.XmlTextWriter($fullFilePath,$encoding)
October 21, 2021 at 11:33 am
Cool thanks!!!!!
Viewing 10 posts - 16 through 24 (of 24 total)
You must be logged in to reply to this topic. Login to reply