p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   How to create calculated fields (http://p2p.wrox.com/showthread.php?t=46522)

MacDevv August 15th, 2006 04:16 AM

How to create calculated fields
Hi there

In my database i have a table person. With the following fields.

Now i want to look up the person table from a combobox. But i can only select one of the field. How can i create a field in my dataset that joins name and surname so i can lookup the full name in my combobox. In delphi this was a calculated field but how do i do this in C#.

MAKO August 15th, 2006 10:31 AM

I've ran into the same problem, but they helped me in this forum, so I think it's time to pass the note.

- Create a table in a dataset using the xsd from VS.
- Add a new column and insert the expression "= name + surname"

with that you'll be ready to populate your combobox and set the new column as its display member.

good luck!

MAKO - "El super simio"

MacDevv August 16th, 2006 01:38 AM

Hi there MAKO thanks for your reply
column expresion:NAME+(', ')+SURNAME

MAKO August 16th, 2006 09:38 AM

Yes MacDevv, you can do just as easy as open your xsd (dataset designer) where the tables are displayed and simply add a new column at the end of your persons table named fullname, or something, and add the expression [name + sourname] in the column properties.

"Hacia la victoria siempre!"

msn = macz02@msn.com

MAKO - "El super simio"

All times are GMT -4. The time now is 06:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.