本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
you can try the following two ways:
1- use dsn. in each report/subreports, you set your dsn respectively, which actually get you the data from the tables/views in the database, and then in all your subreports you use the record selection function to filter and match you data for the subreports, this is the old way, if your tables/views hold huge data that would be very slow to show the whole reports;
2- use ttx/ado. in your main report/subreports, set the database sourse to a series of ttx files, and then in your program you call the sp to get the reqiured recordset, and then send the setdata command to the crystal reports, and show the reports. you also should set the record selection fomular in your subreports to get the matched data for it. this would give u the best perfomance coz the recordset returned is filtered instead of the whole table.
in both situation, you should make sure you have set the field link for your main report and subreports so that the record selection function in your subreports would work.
good luck to you!
更多精彩文章及讨论，请光临枫下论坛. 网址: rolia.net/zh