January 26, 2016 at 11:54 am
I have a loop statement in powershell, and it's give me error. I think that "+$Row2+" as 'col 2' is not right.
anyone could help? Thanks so much
foreach($Row in $DataSet.Tables[0].Rows)
{
$Row1
$Row2= $Row[0]
$Row3= $Row[1]
$Row4= $Row[2]
$Row5= $Row[3]
$Query_grab = "
use "+$Row2+"
select * from
(
select '12' as 'col 1'
"+$Row2+" as 'col 2'
from table a
left outer join table b on a.id = b.id
group by b.groupname
) as x"
January 26, 2016 at 12:19 pm
Please supply the error details!!!
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
January 26, 2016 at 12:24 pm
This is the error message
Exception calling "Fill" with "1" argument(s): "The SelectCommand property has not been initialized before calling 'Fill'."
January 27, 2016 at 2:16 am
I think that your error does not occur (but may exist) in one of the lines of code supplied. Can you supply more context i.e. more lines of code before and after?
Which line is highlighted as having an error?
Are you using PowerShell ISE? It can help.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply