I am reading in lines from a comma seperated text file and then validating the information against a database. I do a lot of validate steps before I actually update any values in the database row.
Now for the question. Is there a way to goto the bottom of the loop without using a a goto statement or should I used the nested ifs as I have already done.
In Case 1 is where things get nested pretty good.
Thanks for any input!
Code:Do While Not EOF(AttrFile) 'Loop until end of file. Line Input #AttrFile, TempString 'If there is a blank row in the data file bypass it 'and go on to the next row. If TempString <> "" Then AttrValues = Split(TempString, AttrDelim) ' If the are there more then 1 object with this ' name in the database then we cannot process ' it. Report back to the error log Select Case CountObjectsNamed(Session, AttrValues(0)) Case 0 ErrorMessage = "Not able to update " & AttrValues(0) & _ " because no object was found with this name." PrintErrorMessage (ErrorMessage) Case 1 ObjectID = GetObjectId(Session, AttrValues(0)) ' Here is what I want but I am forced ' to used a nested if. ' If ObjectID = "" Then goto the end of ' the loop If ObjectID <> "" Then Set TempObject = New DObject With TempObject .ID = ObjectID .Session = SessionID End With ' Here is what I want ' If TempObject.LockOwner <> "" ' Then goto the end of the loop If TempObject.LockOwner = "" Then For i = 2 To UBound(AttrNames) ' Start processing attributes Next i MaxObjectsFound = MaxObjectsFound + 1 TempInteger = dmAPIExec("flushcache," & Session) End If End If Case Else ErrorMessage = "Not able to update " & AttrValues(0) PrintErrorMessage (ErrorMessage) End Select End If Loop


Reply With Quote
