Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Converting datatypes, not sure if this is right?

Author  Topic 

RubyRue
Starting Member

1 Post

Posted - 2007-09-28 : 05:03:34
New to developing. We are working on a project using asp.net and c# where data is pulled out of an sql database via multiple tables and displayed via a details view. The user can then update the information and submit it back to the database.

The problem we are encountering is:

Within the database there are multiple tables joined by a FK for example there is a Service Group ID column with the Records main table linked to the Service Group table which holds an ID column and a Service Group column so ID1 = Service Group A. Any records within the main table which has an ID of 1, is shows as Service Group A in the details view.

What we wold like to do is when a user updates the Service Group via a drop down, the ID goes into the main table rather than the Service Group name so if they select Service Group B, an ID of 2 goes into the Records main table. We aren't sure how to go about doing the conversion of Service Group B to an ID 2? We have been looking at converting datatypes but don't think it is right for what we are trying to do,

Any suggestions would be gratefully recieved Apologies if this is in the wrong forum.

thanks

Kristen
Test

22859 Posts

Posted - 2007-09-28 : 05:56:26
Not sure I've fully grasped it, but its quite common to have a Lookup Table to convert the IDs that the database uses to the Pretty Names the user might see.

So your Records main table might have an ID (2 = Group B) and the Lookup Table would have ID & Description columns, so that would be "2" and "Group B", and then your pick-list can still say "Group B" but actually send a value of "2" back to the database.

Kristen
Go to Top of Page
   

- Advertisement -