The first thing you need to do is remove all declarations from your For loop, next declare your Cmd as a page-level variable. the way you have it now, your declaring a new instance of these items for each iteration.
Can you post a sample of what the values would be for SQL, SQL2 and SQL3. (The values of each once your routine is complete)
Also, I noticed you have a "GoTo StartOver" in one of your loops, this is a big NO-NO. You can end up in an endless loop real easily, there are so many new string functions in .NET you should be using instead.