line break in sql statement

All, I have a stupid little issue, and I don’t know the right keywords to find the answer. I’m sure it must be somewhere in the documentation or the forum:
I need to create a trigger, and the line needs to break for the trigger body.
What I tried, does not work. Question is: how do it do this?

[quote] App.DB.SQLExecute(“CREATE TRIGGER [triggername] AFTER UPDATE OF [fieldname] ON [tablename] BEGIN” _
“INSERT INTO [tablename2] ([FN]) VALUES ([old].[FN])” _
“END;”)[/quote]
So this is not about how to create a trigger, but how to write the line break in the statement correctly.

thanks

You need some +'s in there to concat the strings.

App.DB.SQLExecute(“CREATE TRIGGER [triggername] AFTER UPDATE OF [fieldname] ON [tablename] BEGIN” + _
“INSERT INTO [tablename2] ([FN]) VALUES ([old].[FN])” + _
“END;”)

Hi Julian. This is not correct. If I do it like this, the SQL engine reads the whole statement as one line, while it has to see a break there… So I need to put a break in XOJO that SQLite will understand as a break. Not just glue everything.

I think “…BEGIN” + endofline+"Insert…
should do the job.

Oh, sorry you need EndOfLine then?

You are missing spaces in your statement.

Try:

App.DB.SQLExecute("CREATE TRIGGER [triggername] AFTER UPDATE OF [fieldname] ON [tablename] BEGIN " _ "INSERT INTO [tablename2] ([FN]) VALUES ([old].[FN]) " _ "END;")
That should work.

All of these somehow don’t work. I also tried chr(13), chr(10).
(Simon, the missing space was just because I write air code – in my real code the space is there).

What’s the error message from sqlite?

Just realised that you are also missing a semi-colon.

Try:

App.DB.SQLExecute("CREATE TRIGGER [triggername] AFTER UPDATE OF [fieldname] ON [tablename] BEGIN " _ "INSERT INTO [tablename2] ([FN]) VALUES ([old].[FN]); " _ "END;")

Thanks all. Taking a closer look at the error message learned me something else actually caused the problem.
The right way to do this was indeed using QUOTE PLUS UNDERSCORE, but my problem was something else. Lesson learned.