473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DataTable.Expression

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
Jan 17 '06 #1
2 1549
Steve Amey wrote:
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

Jan 17 '06 #2
Hi Steve

Try this:

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

Maybe it helps?

Martin
Jan 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Coreymas | last post by:
Hello everyone Here is what I am trying to do I have a datatable with 7 columns (called Mon, Tue, Wed,...) representing the days of the week I want to create a calculated column called...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
3
by: Edward Mostrom | last post by:
I have 2 tables that have a relation between them. The parent table also has an expression in a column that sums the values in the child table. Both tables are hooked up to datagrids. ...
3
by: MrNobody | last post by:
I've read that the expression property for DataColumns is used to "Sets or retrieves the expresssion used to filter rows, calculate the values in a column, or create an aggregate column.". I...
0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
1
by: Geoff Jones | last post by:
Hi Is it possible to change the type of data a column holds in DataTable at runtime? For example, suppose that the table column originally holds Strings, can we, at runtime, change it to...
11
by: Bruce D | last post by:
I have a DataTable that I need to merge the 'lastname' and 'firstname' fields to be displayed in a datagrid. I know I can use the SQL statement to merge the fields into one, but I want to know if...
6
by: Nick | last post by:
I have a code that returns data in IList. My webGrid doesn't allow me to sort with IList returned, it say it only suports DataView, DataTable and DataSet, not IEnumerable. I don't know how to...
4
by: Dennis | last post by:
I am trying to set up an Expression column in a DataTable for display in a DataGrid that subtract the column ("BirthDay") from todays date. I can't seem to get it right...is this possible? --...
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.