如何在VS2010 RDLC报告中链接多个表
我有两个通过主键链接在一起的表...作为示例,
Genre
-----
GenreID
GenreDescription
Track
-----
TrackID
GenreID
TrackName
我想显示如下内容:
TrackID Name Genre
1 Track1 Pop
2 Track2 Pop
3 Track3 Rap
4 Track4 Rock
如何编写自定义 SQL 语句并将字段添加到数据库中?目前,我只能从数据库中选择Table、View、SP和Func。我应该在哪里编写自定义 SQL 语句并连接所需的表?
谢谢。
I have two tables which are linking together by primary key... as an example
Genre
-----
GenreID
GenreDescription
Track
-----
TrackID
GenreID
TrackName
I want to show like the following
TrackID Name Genre
1 Track1 Pop
2 Track2 Pop
3 Track3 Rap
4 Track4 Rock
How can I write custom SQL statements and add the fields into the database? At the moment, I can only choose Table, View, SP and Func from the Database. Where should I write custom SQL statements and join the required tables?
Thanks.
您需要通过连接 GenreID 上的 Track 和 Genre 数据集来创建新的数据表。然后将新数据集添加到您的报告中并据此进行设计。
您可以使用自己的 SQL 连接现有表,在设计器中轻松创建新数据表。
You will need to create a new data table by joining the Track and Genre data sets on GenreID. Then add the new data set to your report and design off that.
You can easily create new data tables in designer by using your own SQL to join from existing tables.