要用于报表的数据源。第2课:指定连接信息Reporti
gServices设置连接1在“报表数据”窗格中,单击“新建”,然后单击“数据源”。注意:如果“报表数据”窗格不可见,请单击“视图”菜单上的“报表数据”。2345在“名称”中,键入Adve
tureWorks。确保已选中“嵌入连接”。在“类型”中,选择MicrosoftSQLServer。在“连接字符串”中,键入以下内容:Datasourcelocalhosti
itialcatalogAdve
tureWorks20086该连接字符串假定Busi
essI
tellige
ceDevelopme
tStudio、报表服务器和Adve
tureWorks2008数据库都已安装在本地计算机中,并且您拥有登录Adve
tureWorks2008数据库的权限。
7
单击“确定”。名为Adve
tureWorks的数据源即被添加到“报表数据”窗格中。
您已成功定义了到Adve
tureWorks示例数据库的连接第3课:为表报表定义数据集Reporti
gServices定义数据源后,您需要定义数据集。在Reporti
gServices中,您在报表中使用的数据包含在“数据集”中。您将创建一个查询,用于从Adve
tureWorks2008数据库中检索销售订单信息。为报表数据定义Tra
sactSQL查询1在“报表数据”窗格中,单击“新建”,然后单击“数据集”。此时将打开“数据集属性”对话框。
f23
在“名称”框中,键入Adve
tureWorksDataset。确保数据源名称Adve
tureWorks位于“数据源”文本框中,并确保“查询类型”为“文本”。将以下Tra
sactSQL查询键入(或复制并粘贴)到“查询”框中。SELECTsohOrderDateASDatesohSalesOrderNumberASOrderppsNameASSubcatppNameasProductSUMsdOrderQtyASQtySUMsdLi
eTotalASLi
eTotalFROMSalesSalesPerso
spINNERJOINSalesSalesOrderHeaderASsohONspBusi
essE
tityIDsohSalesPerso
IDINNERJOINSalesSalesOrderDetailASsdONsdSalesOrderIDsohSalesOrderIDINNERJOINProductio
ProductASppONsdProductIDppProductIDINNERJOINProductio
ProductSubcategoryASppsONppProductSubcategoryIDppsProductSubcategoryIDINNERJOINProductio
ProductCategoryASppcONppcProductCategoryIDppsProductCategoryIDGROUPBYppcNamesohOrderDatesohSalesOrderNumberppsNameppNamesohSalesPerso
IDHAVINGppcNameClothi
g
4
5
(可选)单击“查询设计器”按钮。查询将在基于文本的查询设计器中显示。通过单击“编辑为文本”,可以切换到图形查询设计器。通过单击查询设计器工具栏上的“运行”按钮来查看查询结果集。单击“确定”退出查询设计器。
6
单击“确定”退出“数据集属性”对话框。此时将在“报表数据”窗格中显示Adve
tureWorksDataset数据集字段。
第4课:向报表添加表Reporti
gServices。向报表布局中添加表数据区域和字段r