Adding a field with an expression in a Dataset

W

Woody Splawn

I may have a mis-understanding of how expressions are intended to be used in
a DataSet. I don't know, it appears that you can take a dataset and add a
field to it that contains an expression from within a DataSet.xsd file, I
mean from within the design window, the one with the yellow background. I
would like to, for example, add a name field to a form that contains an
expression of something like Fname + lname.

So... I have a form. I created a dataset from within the form using a data
adapter (generate dataset) It exists in the component tray at the bottom of
the form and there is a reference to it in the Solution Explorer. I double
click on it in Solution Explorer to acces the design window. At the bottom
of the grid I add a row. I call it an element, name it "name" and call it a
string. In the Expression property I type in "Fname + ' '+Lname".

When I save the .xsd file, it no longer shows up in my component tray of the
form and the form is no longer functional.

Did I mention that I may have a misunderstanding of how expressions are
intended to be used? <g>
Could someone tell me if Expressions are designed to be used in this way?
If so, what do I need to do differently. If not, is there an easy way to
add a calculated field to a form that contains concatenated information like
fname/Lname?
 
M

Manpreet Juneja \(GrapeCity\)

Hello Woody,

I was able to replicate your problem. The problem is occurring because
you're passing the value for the 'Expression' property in quotes.
Set the Expression property of the element to Fname + ' '+Lname (don't
enclose it in double quotes). This would solve the problem.

Thanks
Manpreet
 

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