Problem sensind Transactions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raulbolanos
    New Member
    • Apr 2009
    • 31

    Problem sensind Transactions

    Hi guys,

    I want to send this transaction but I got an error.

    Code:
    string cmdString = @"IF (5 > 0) BEGIN PRINT 'Hi..' END";
    
    MySqlCommand command = new MySqlCommand(cmdString, m_connection);
    ActivateDatabaseApplicationRole();
    using (transaction = m_connection.BeginTransaction())
    {
    	Trace.WriteLine("\n\nBEGIN INSERT\n\n");
    	//AC foreach (OleDbCommand command in sqlCommands)
            foreach (MySqlCommand command in sqlCommands)
    	{
    		Trace.WriteLine(command.CommandText);
    		command.Transaction = transaction;
    		command.ExecuteNonQuery();
    	}
    	transaction.Commit();
    }
    transaction = null;
    whather that an IF or Variable declaration I get this error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF (5 > 0) BEGIN PRINT 'hallo' END"..........

    what do you think?

    thank you.
Working...