you need to assign transaction to command just like we assign connection to command before we execute command
command.Transaction = transaction;
if you begin a transaciton on a sqlConnection, all commands belonging to that connection need to assign a transaction first