Adding an Expression to a Dataset Schema

 

1.  Open the dataset file from the solution explorer, i.e. dsEmployee.xsd file.

 

2.  Scroll to the last line of the table in which you want to add the concatenated field.

 

3.  Click to the right of the asterisk and select E element from the drop-down list.

 

4.  Type the name of the field in the first column, i.e. “fullname”.

 

5.  Select the data type in the last column (string is the default Data Type).

 

6.  Make sure the new field (element) is selected.  In the Properties window, create the desired expression in the Expression property.  For example if you want to concatenate “lname” and “fname”, type this into the Expression property:  lname + fname.

 

7.  After entering the expression, you MUST select Rebuild Solution from the Build menu.

 

8.  Now you can include the new field in your program.

 

 

Expression examples:

 

To print a comma with a space between two fields, you must use single quotes:

Anderson, Mark          lname + ‘, ’ +  fname

 

To combine several fields with a space between, use single quotes and SQL concatenation operator (+):

Mark A Anderson       fname + ‘’ + minit + ‘’ + fname

 

Revised 4/11/05 at 10:00 am