Click to See Complete Forum and Search --> : Problem sensind Transactions


raulbolanos
June 15th, 2009, 03:53 AM
Hi guys,

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


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.