[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

If I use SQL 2005 to setup the relations between tables, will the relationships be maintained when I create a dataset using the tables?

Posted on 2007-11-19
4
Medium Priority
?
164 Views
Last Modified: 2010-04-21
I was wandering if I built relations in the database in SQL 2005, does the relations flow through when you setup a dataset in C#?

Thanks
Kenny
0
Comment
Question by:kwh3856
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20317806
yes: the relations are implemented using foreign key constraints, and can hence be reflected in the dataset
0
 

Author Closing Comment

by:kwh3856
ID: 31410067
Thanks
0
 
LVL 42

Expert Comment

by:dqmq
ID: 20317827
>I was wandering if I built relations in the database in SQL 2005, does the relations flow through when you setup a dataset in C#?

You can add FK relations to the dataset and they will be enforced as you make changes to the dataset.  However, they do not appear automatically just because they are defined in the database.
0
 
LVL 6

Expert Comment

by:cottsak
ID: 20317852
provided the dataset targets more than one table where there are relationships.
for example if table A and B are related but C is not, if the dataset includes A and C then the relationship to B will not be maintained because it';s not in the scope.

use the Visual Studio visual dataset designer and drag the tables from the database in the Server Explorer pane to the dataset designer - if two tables have a relationship then the designer will create the relationship after you drag the tables on.

BE AWARE that if you modify the relationships in the DB, the dataset (which is really xml metadata) will NOT update automatically. you need to open up the designer again and edit and save the schema of a table for Visual Studio to re-query the database for the relationship changes. (hopefully this will be addresses in VS2008)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question