2

I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder to build the following command string:

DELIMITER $$

DROP TRIGGER /*!50032 IF EXISTS */ dbname.table$$

CREATE TRIGGER dbname.inserttrigger AFTER INSERT ON dbname.table

FOR EACH ROW BEGIN

...

END;

$$

DELIMITER ;

when I try cmd.executeNonQuery() an Exception occurs (Error in SQL syntax) which is despite the new lines referring to LINE 1. - The Stringbuilder will put in "\r\n" for every AppendLine().

If I copy and paste the command to the MySQL console it runs fine.

1 Answer 1

1

This seems to have been a bug in MySQL with the DELIMITER statement, not sure it's the same you're hitting. Was fixed in a recent version of MySQL. If you're not using the latest version, try to update MySQL and try again.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Abel. I'm using 5.0.77. I'll upgrade to 5.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.