あるデータベース (会社とすべての会社の顧客のリスト) からいくつかのデータを取得し、他のデータベース (すべての顧客の項目のリスト) からそれに接続されたいくつかのデータを取得するレポートを作成しています。表示されるデータは 1 つの DataSource しか使用できず、DataSource は 1 つのデータベースへの接続であるようです。私はグーグルでサブレポートについて読んで、この解決策を試しましたが、レポートは同じように見えません(たとえば、サブレポートがある会社、顧客、アイテムの列があり、サブレポートには2つの列が含まれていて、好きではありません)それらは 1 つの列に表示されます...)。サブレポートは、クロスデータベースのデータを表示する唯一の方法ですか?
2 に答える
Yes a single report control (table, list etc) can only display data from one dataset. You do have a couple of options though.
You can reference multiple databases from a single dataset if they are on the same server or if one server is linked to the other. For example if you have both databases (company, customerdata) on the same server then
Select co.CompanyName, cu.CustomerName, ci.CustomerItem1
From company.dbo.Companies co
Inner Join company.dbo.Customers cu On cu.CompanyID = co.CompanyID
Inner Join customerdata.dbo.CustomerItems ci On ci.CustomerID = cu.CostomerID
If the databases are of different servers but are linked then you can refer to the tables using servername.databasename.schema.tablename
instead. In both cases you need to make sure the login you're using has appropriate permissions on both sides.
Alternatively you could use SSIS to pull the tables from both databases into a common database prior to running the report perhaps scheduling to run overnight or periodically during the day.
私はrdlcのサブレポートを使ってこのようなことをしました。rdlで実行できるかどうかはわかりませんが、rdlcでは、すべてのサブレポートが実際には独自のDataSourceでレポートされます。よろしく、イオーダン