Filling a strongly typed dataset

J

Jeff Mason

There's clearly something I just don't understand about setting up
strongly typed datasets.

I've created one. The dataset has 6 tables in it and various
relationships between the tables.

I created this dataset by first creating a stored procedure which
returns 6 resultsets, one for each table. I dragged the stored
procedure onto the designer from server explorer. This defined the 6
tables. I renamed the tables using meaningful names - the designer
created the first table with the name of the stored procedure, and the
next ones named "Table1", "Table2", etc. Next I set up relationships
between the tables and took the default names.

When I try to fill the dataset via an SqlDataAdapter, my tables don't
have anything in them; instead the fill created 6 new tables named
"Table", "Table1", etc. My data's in them.

How do I get the dataset to load the data into the tables I have
created? I tried setting up tablemappings between the Table<n> names
and my names, but that crapped out with constraint violations.

What am I doing wrong?

Thanks for any help anyone can provide.
 
W

W.G. Ryan eMVP

make sure you specify the names in the TableMappings Collection of the
dataset and you'll probably want to set the ColumnMappings for each of the
table mappings if the names of the colums in the DB differ from the ones in
the dataset.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top