loDataProviderIndex.CommandTextAdd("EXECSCRIPT(""USE " + Trim(loRowTable("Table")) + " EXCL"")") loDataProviderIndex.CommandTextAdd("EXECSCRIPT(""DELETE TAG ALL"")") loDataProviderTag.ParameterAdd("NoTable", oRow("Numero")) If Not loDataProviderTag.SQLExec("SELECT Tag.Tag,Tag.Name FROM Tag " + _ "WHERE Tag.NoTable=" + loDataProviderTag.ParameterAddSQL("NoTable")) Then Return False End If For lnCounter = 0 To loDataProviderTag.nCount - 1 loRowTag = loDataProviderTag.oDataSet.Tables("Temp").Rows(lnCounter) loDataProviderIndex.CommandTextAdd("EXECSCRIPT(""INDEX ON " + Trim(loRowTag("Tag")) + " TAG " + Trim(loRowTag("Name")) + """)") Next loDataProviderIndex.CommandTextAdd("EXECSCRIPT(""USE"")")loDataProviderIndex is just my data provider class. The key here is to add the all the commands in oCommand. I use also a method of the data provider class named CommandTextAdd(). Basically, this is a method that adds into a collection that is named oCommandText. Then, when I am ready to execute everything, I can scan the collection and do something like:
' Execute all commands For Each lcCommandText In oCommandText oCommand.CommandText = lcCommandText oCommand.ExecuteNonQuery() NextWhere oCommand is defined as:
Private oCommand As IDbCommand = Nothing