Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2006, 04:16 AM
Authorized User
 
Join Date: Jul 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to create calculated fields

Hi there

In my database i have a table person. With the following fields.
Name
surname
gender
telephone

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#.

 
Old August 15th, 2006, 10:31 AM
Authorized User
 
Join Date: Feb 2006
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MAKO
Default

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"
 
Old August 16th, 2006, 01:38 AM
Authorized User
 
Join Date: Jul 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there MAKO thanks for your reply
column expresion:NAME+(', ')+SURNAME
 
Old August 16th, 2006, 09:38 AM
Authorized User
 
Join Date: Feb 2006
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MAKO
Default

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 = [email protected]

MAKO - "El super simio"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Calculated Fields in Queries SerranoG Access 0 August 14th, 2006 10:04 AM
Help with summing calculated fields on a report dbartelt Access 6 January 4th, 2006 03:33 PM
Storing Calculated Fields dearnne Access 3 September 2nd, 2004 05:30 PM
Storing Calculated Fields dearnne Access VBA 1 August 30th, 2004 10:54 AM
Summing the Results of Two Calculated Fields CloudNine Access 1 December 24th, 2003 12:05 PM





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