CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2009
    Location
    Stuttgart, Germany
    Posts
    56

    Problem sensind Transactions

    Hi guys,

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

    Code:
    string cmdString = @"IF (5 > 0) SELECT dbIndex FROM VerCommonHeader WHERE productNumber = 'XyX' AND internalSerialNumber = 'A1B2C3' AND rtsStatus = 2";
    
    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.
    Last edited by raulbolanos; June 15th, 2009 at 09:15 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured