Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
acko
Yak Posting Veteran
52 Posts |
Posted - 2003-08-20 : 13:39:44
|
HiI need help with creating data report in vb6.I am using data report designer and DataShape.For example, how can I show data report without using DataEnvironment.SHAPE { SELECT * FROM Customers} & " APPEND ({SELECT * FROM Orders } & " RELATE CustomerID TO CustomerID)rs.Open....How can i bind this rs to rpt if i have created rpt.I want to show customer's information in the page header and order information in details section.ThanksAlex. |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-08-20 : 13:48:27
|
This one is going to be tricky because for each row in customers, you'll have an entire recordset listing their orders. This nested recordset approach is not easy to handle in standard ADO. To be perfectly honest you're better off not using it.Instead, you should write a regular recordset using a JOIN to include the customer info:SELECT Customers.CompanyName, Customers.CompanyContact, Customers.Address, Customers.City, Customers.Phone, Customers.PostalCode, Orders.OrderID, Orders.OrderDate, Orders.RequiredDate, Orders.ShippedDate, Orders.ShipVia,Orders.Freight, Orders.ShipName, Orders.ShipAddress, Orders.ShipCity, Orders.ShipRegion, Orders.ShipPostalCode, Orders.ShipCountryFROM Customers INNER JOIN Orders ON Customers.CustomerID=Orders.CustomerIDORDER BY Customers.CompanyName, Orders.OrderIDYes, you will see duplication of Customer info, but you can write code to test for it and remove the duplication from the report. Additionally, if the report you're writing can do its own grouping, you can create a grouping level to consolidate the customer information and put only the order info in the detail section. |
 |
|
|
|
|
|
|