Multiline in IDE?

Hey there,
is something like this possible?:

dim sql as string sql={ select * from tablea where somefield like '%bla%' order by id desc }

so i dont have to do
sql=sql+"
all the time?
I know i can save it in a constant e.g. but i’d like to have it in my code like i described above.

thanks in advance! :slight_smile:

Like this :slight_smile: End the lines with “[space]_”

dim sql as string
sql="select * from tablea " _
+ "where somefield like '%bla%' " _
+ "order by id desc"

I wonder if static strings concatenated like that are optimized to a single string during compilation or not.

Another method is to use a constant, which many times is easier and cleaner code. In the constant editor, you can type in multiple lines.

They are.

Great! What about when using constants in the statement or even EndOfLine? Both are known at compile time.

[quote=117324:@Albin Kiland]Like this :slight_smile: End the lines with “[space]_”

[code]
dim sql as string
sql="select * from tablea " _

  • "where somefield like ‘%bla%’ " _
  • “order by id desc”
    [/code][/quote]
    Like this one, but its still + and " at begin and " _ at the end…^^ its like the sql=sql+"" just shorter :smiley:

Hm? Dont get what you mean…
Can you explain it to me more detailed? :slight_smile:

[quote=117357:@Jan-Ole Berger]Hm? Dont get what you mean…
Can you explain it to me more detailed? :)[/quote]

Sorry, I hijacked your thread, didn’t mean to. My question to Joe was if Dim sql As String = kBaseSQL + " abc xyz" was optimized at runtime or not. i.e. He said Dim sql As String = "ABC" + "DEF" is optimized, so if you introduce a constant, it is still optimized.

Please ignore that question here Joe, as I did hijack and shouldn’t have.

Ah :smiley: now i got it.
No problem, its a forum. :wink: