473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PowerShell Looping Problem

Hi,

I have two datatables that I'm attempting to loop through in a nested loop.
I am never able to hit in the second loop when I'm using a second datatable. However, if I store the information in an array then I'm able to hit the second loop.
I have ran tests to make sure the information is getting filled in both datatable so I know that isn't the problem.
If I do seperate ForEach loops, I am able to loop through both tables successfully. However, at this point, for my purposes I need to nest them.
Can anyone point me in the right direction?
Here is my code
Expand|Select|Wrap|Line Numbers
  1.  foreach ($iRow in $tableIns.Rows)
  2.          { 
  3.            Write-Host "<instance id=""$($iRow[2])"">";
  4.  
  5.             foreach ($rRow in $tableRev.rows)
  6.             {
  7.             Write-Host "hello";
  8.             }
  9.           }
  10.  
Jun 24 '15 #1
0 1253

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: CJ | last post by:
Can someone look at the code below and tell me whats going on? Here is the problem. I can successfully telnet one of our routers and successfully put in a command in the while statement, but...
2
by: CanoeGuy | last post by:
I have an array that I am populating from a database. I am looping through the array to write the values to a datagrid. At this point, I'm stuck. I can't figure out how to read the first four...
6
by: vasilijepetkovic | last post by:
Hello All, I have a problem with the program that should generate x number of txt files (x is the number of records in the file datafile.txt). Once I execute the program (see below) only one...
1
by: Nicole | last post by:
Hello! I hope there is someone out there who can shed some light on this for me. I have a module that is supposed to look at an access table, pull out each bid record, link to another table to...
5
by: Bruce Lawrence | last post by:
I'm running Access 97 and my modules are looping if someone puts an invalid value in. The setup: 3 macros - get_clock_num, verify_clocknum, append_to_history 3 functions. each in their own...
6
by: Mike | last post by:
Hello, This game will not loop. It compiles, builds, and executes fine, but the game will not loop around no matter what I do. What is wrong with the code? What do I have to add to make it loop...
1
by: Kelvin | last post by:
Hi All, I wrote a program insert new row between rows while the datatable is looping. It display the error message. Exception Details: System.ArgumentException: This row already belongs to this...
2
by: nasirmajor | last post by:
dear all, i have a listbox whose items are displayed in listbox e.g ('1','3','4',) my problem is the last comma (, after 4) i don't want this comma as i have to use this string in sql query....
3
by: Steven Smith | last post by:
Hi everyone, This code makes sense to me, but when I run it, it says "Loop Without Do". Any Suggestions? Thanks, Steven Smith Dim FirstPaymentDate As Date
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.