Fill a joined typed dataset

J

Jeronimo Bertran

Hi,

I am creating an order detail dataset for a particual order using a typed
dataset.


I created a stored procedure:

CREATE PROCEDURE SPOrderDetail
(
@OrderID int
)
AS
SELECT OD.ProductID, OD.UnitPrice,OD.Quantity, P.ProductName
FROM OrderDetails OD INNER JOIN Products P
ON OD.ProductID = P.ProductID
WHERE OD.OrderID =@OrderID


Now my question is if I can use this stored procedure to fill a typed
dataset that has tow distinct table (OrderDetails and Products) and defines
a relationship or do I have to create a typed dataset that holds all fields
from the SP on a single table?

Thanks,

Jeronimo Bertran
 
K

Kevin Yu [MSFT]

Hi Jeronimo,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know if you can use the
joined table to fill multiple tables in a typed DataSet. If there is any
misunderstanding, please feel free to let me know.

As far as I know, we cannot use this stored procedure to fill the
DataTables, since no table in the DataSet contains both columns from Order
and Products table. In this case, I strongly recommend you create 2 stored
procedures, which fill 2 tables in the DataSet seperately. Then we can
create a relation object between 2 tables. If you need to see the Product
information in the OrderDetails table, you can add an expression column in
the OrderDetails table to achieve this.

For more information, please check the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatacolumnclassexpressiontopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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