I am pretty new to VB.net and am having trouble figuring out how to do this.
I have an app that copies data from one datasource to another.
I have it set to run through a for loop for each row in SourceDataTable.
for each row i get the a value that is not an ID and I have a funciton that compares this to a column in the Destination, and i recieve the ID back if it exits and nothing if it doesn't. This work fine the next part I am having trouble with.
I then have an IF statement that test if the ID is returned or not then chooses whether to run the Insert if it does exist or If the ID doesn't exist i want to open up a form where i can choose (and return) the ID i want to use (i know how to set all this up)
the problem i am having is that i the for loop that is transferring data from the source to the destination keeps going.
here is the for loop i am using, i just need to know how to stop the loop from running while i am retrieving strID from a new form. i have put this bit in red
Expand|Select|Wrap|Line Numbers
- For i = 0 To dbDataTable.Rows.Count - 1
- 'get the value for the ID to compare
- str1 = dbDataTable.Rows(i)(0).ToString
- str1 = Replace(str1, "'", "")
- 'compare the source ID to the destination ID column to see if it is to be update or insert
- strID = Compares.ReturnDestinationID(dbDestinationDataset, str1)
- If strID = "" Then
- 'open form for retrieving ID to use for insert
- strID = Value recieved back from other form
- 'run insert sub using the new strID
- Inserts.InsertDataRowToDestination(dbDataTable.Rows(i), strID)
- Else
- 'this is a sub I have created to insert the data row to the destination table
- Inserts.InsertDataRowToDestination(dbDataTable.Rows(i), strID)
- End If
- Next