Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I always seem to find what I need in previous threads without starting my own. I have started a couple but that's it..."

Geography

Where in the world do Tek-Tips members come from?

ADO.Net - Populate dataset with sql server tables and relations

spangeman (Programmer)
15 Sep 10 17:34
Hi

Is there an easy way of populating an ADO dataset with a set of tables (and their data) from SQL Server and then all their relations based on the Foreign Key constraints defined on the SQL server database.

All examples I have seen online when googling show the relations being coded one by one in C# but I want them to be taken automatically from the relations that already exist on the tables in SQL server as FK constraints.

I am using c# under .NET Framework 4

I want to do something like......

1. Declare dataset.
2. List tables I am interested in and add these to the dataset with all of their data.
3. Add all relations based on FK Constraints in SQL Server DB.
jmeckley (Programmer)
16 Sep 10 9:40
create a strongly typed dataset to reflect the information you need.

I don't see much value in duplicating the schema in memory though. This only applies to simple forms-over-data UIs. anything beyond that and you are working with subsets of data in a context specific way. the context may not align 1:1 with the database schema.

Jason Meckley
Programmer

FAQ855-7190: Database Connection Management
FAQ732-7259: Keeping the UI responsive

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close