Can you post all the code in the file that is throwing the exception? It appears you have a different command (cmd3) being built when an exception happens, which is not the ideal way to handle the logic to build different commands. Using structured exception handling to control logic flow in your application is asking for trouble.
@karl Thanks, i will look to touch that up now, i also agree that the flow is asking for trouble. It is working now thanks to George Johnston answer below, but i will neaten up and order the code.
I would go out on a limb (because I don't see it in the above code) and say it's because you didn't set the cmd2.CommandType to StoredProcedure. By default, the command type is Text, which is used for inline SQL.
cmd3) being built when an exception happens, which is not the ideal way to handle the logic to build different commands. Usingstructured exception handlingto control logic flow in your application is asking for trouble.