string wrap in between sql statement

  • Thread starter Thread starter Joerg Trumpfheller
  • Start date Start date
J

Joerg Trumpfheller

Hey freakz,

I have a sql staement like this (for MS-SQLServer):

Dim command As OleDb.OleDbCommand
command.CommandText = "SELECT Table1.ID, ISNULL(Table1.STATUS, '') AS
STATUS, " & _
" LEFT(ISNULL(Table2.Field1,''), 3) + ' ' + ISNULL(Table1.TEXT1, '') AS
TEXT1 " & _
" FROM Table1, Table2 " & _
" WHERE Table1.ID=Table2.ID AND (Table1.SearchID = " & Me.SearchID & ")"


The result for this statement is put into a dataset (fill), which will be
diplayed as markers and labels on an image.

Now I want to extend this statement with a new textfield which should be
displayed (inside this imageviewer) below the other textfield (word wrap?)

The example below does not work. TEXT2 is a string without crlf between
TEXT1 and TEXT2

command.CommandText = "SELECT Table1.ID, ISNULL(Table1.STATUS, '') AS
STATUS, " & _
" LEFT(ISNULL(Table2.Field1,''), 3) + ' ' + ISNULL(Table1.TEXT1, '') AS
TEXT1, " & _
" LEFT(ISNULL(Table2.Field1,''), 3) + ' ' + ISNULL(Table1.TEXT1, '') + ' &
Chr(13) & Chr(10) & ' + ISNULL(Table1.TEXT2, '') AS TEXT2 " & _
" FROM Table1, Table2 " & _
" WHERE Table1.ID=Table2.ID AND (Table1.SearchID = " & Me.SearchID & ")"


Does anybody know how I can realize carriage return and line feed in between
this statement?

Thanks for help. Joerg
 
Hi Joerg,

you do it as you mentioned, simply add CR/LF to the selection string like
this:
....ISNULL(Table1.TEXT1, '') + char(13) + char(10) + ISNULL(Table1.TEXT2, '')
AS TEXT2 ...

regards

Mike
 
Back
Top