DataTable.Expression

S

Steve Amey

Hi all

I am storing some information in a database, including the Expression's for
columns in a DataTable. In this Expression, I want to display 2 fields,
Address and Contact, but seperated by a new line, so the Contact appears on
the line underneath Address.

I have the following stored in my database for the DataColumn:
'Main Contact: ' + Contact + 'Main Address: ' + Address

I have read the help on Expressions and it states that you can use \n for a
new line and \r for a carriage return, but when I put these in the
Expression I get an exception. Eg:
'Main Contact: ' + Contact + \r + 'Main Address: ' + Address
gives me the following exception:
Cannot find column [\r].

So my question is, how do I format the string in my database so when I set
the DataColumn.Expression property it doesn't raise an exception and I get
the 2nd column on a line underneath the 1st column?

Thanks for any help.

Kind Regards,
Steve
 
C

Chris

Steve said:
Hi all

I am storing some information in a database, including the Expression's for
columns in a DataTable. In this Expression, I want to display 2 fields,
Address and Contact, but seperated by a new line, so the Contact appears on
the line underneath Address.

I have the following stored in my database for the DataColumn:
'Main Contact: ' + Contact + 'Main Address: ' + Address

I have read the help on Expressions and it states that you can use \n for a
new line and \r for a carriage return, but when I put these in the
Expression I get an exception. Eg:
'Main Contact: ' + Contact + \r + 'Main Address: ' + Address
gives me the following exception:
Cannot find column [\r].

So my question is, how do I format the string in my database so when I set
the DataColumn.Expression property it doesn't raise an exception and I get
the 2nd column on a line underneath the 1st column?

Thanks for any help.

Kind Regards,
Steve

I think the real question become, what are you displaying the data in.
That is what is going to have to handle the carrage return. But to
answer your immediate question you need to do is:

'Main Contact: ' + Contact + '\r' + 'Main Address: ' + Address
 
M

Martin Widmer

Hi Steve

Try this:

'Main Contact: ' + Contact + '\r' + 'Main Address: ' + Address

Maybe it helps?

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top