Creating Strongly Typed Data Set

G

Guest

Hi,
I created a strongly typed data set that contains two tables (Orders and
OrdersDetails). The tables have a parent/child relationship.

How can I populate both tables based on values returned by a stored
procedure in such a way so that the OrderDetails table contains only data for
orders that exist in Orders table (i.e. preserving the parent/child
relationship)?

I'm usng SQL 2000 and .NET 2.0

Thank you.
 
C

Cowboy \(Gregory A. Beamer\)

SELECT * FROM Orders
WHERE X = 'y'

SELECT * FROM OrderDetails od
JOIN Orders o
ON od.OrderID = o.OrderID
WHERE o.X = 'y'

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 
G

Guest

Gregory,
But I was refering to how can I populate the tables from the dataset.

Thanks
 
J

jmbledsoe

I don't want to sound like a marketing guy, but this is the exact same
problem that I had. It was such a PITA, that I built a tool to do this

for me, and now my company is selling it (free to try, and under $100
to buy). It's called the DataSet Toolkit, and it has a class called
the MultiTableDataAdapter which does fills and updates of multiple
tables in a DataSet.

One feature is that it allows you to fill multiple tables using the
same WHERE constraint. With this framework, you would create an
instance of MultiTableAdapter, and call the following:

(Assume your DataSet has two tables: Orders and OrderDetails)

multiTableAdapter.Fill(dataSet.OrderDetails, new
ValueWhereConstraint(dataSet.Orders.XColumn, "y");

That single line of code will fill the OrderDetails table and the
Orders table, using basically the same SQL statements that Cowboy
specified. I use it everyday, and it's simplified my programming a
lot.

Try this out, and let me know what you think.

http://www.hydrussoftware.com


John B.
http://johnsbraindump.blogspot.com
 

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