Microsoft报表(RDL)如何查询数据?
我不是从头开始创建 RDL,所以这可能是一个问题——我处理已经准备好的文件。
MSDN 指出 RDL 文件中的 CommandText 可以包含 T-SQL 查询。好吧,我明白了,但是它还能包含什么?
我这样问是因为措辞清楚地表明您可以在那里添加其他表达方式 因此,如果我理解正确,我可以查看 RDL 代码(在 Visual Studio 中,RDL 文件上的人民币,“查看代码”),有趣的部分是......?
- DataSourceName - 这是通过数据源定义到数据库的“链接”
- CommandText - 我认为这是放置查询的地方,例如 SELECT ...但从我看来,没有使用任何查询
I am not creating RDL from scratch so maybe this is a problem -- I work on already prepared files.
MSDN states that CommandText in RDL file can contain T-SQL query. Ok, this I understand, but what else it can contains?
I am asking because the phrasing clearly indicates you can put some other expression there
So if I understand correctly, I can look at RDL code (in Visual Studio, RMB on RDL file, "view code") and the interesting parts would be...?
- DataSourceName -- this is a "link" to database via definitions of data sources
- CommandText -- I thought this is the place to put query, like SELECT... but from what I see there are no queries used
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
报告服务,将 rdl 文件加载到其中,并根据
数据源、报告参数等部分开始解析和读取命令,
获取参数值(如果有)。开始使用数据源数据库连接。执行query/sp命令。获取数据,并将其存储在单独的数据字段中,这些字段也在 rdl 中提到。将它们的值与控件(文本框、网格列等)绑定,如果有任何表达式写入其中,也执行它们。
生成输出(html/pdf)。
就这样吧。
我只是试图用简短的语言来解释。您可以查看 msdn 以获取完整的详细信息。
问候,
马扎尔·卡里米
Reporting service, loads the rdl file into it, and starts parsing and reading the command according to their sections like
data source, report params, etc.
gets the values of params (if any). start using the data source database connection. execute the query/ sp command. get the data, and store in seperate data fields which are also mentioned in rdl. binds their values with controls (text box, grid columns etc), if there is any expression written into it, execute them as well.
Generate the output (html/ pdf).
And there you Go.
I just tried to explain in short and simple words. you can check out msdn for complete detail.
Regards,
Mazhar Karimi
您可以手动创建报告并用您想要的任何数据填充它们。
某某喜欢:
You can create reports manually and fill them with any data that you would like to.
Sth like:
您可以使用 Notepad++ 等 XML 编辑器打开报告文件
*.rdl
。 a> 然后,搜索
,您将找到报告中使用的数据集。
部分
部分中,您可以找到部分。
和
如下面的示例所示示例:
我没有找到一种方法可以在 Visual Studio 的报告编辑器中轻松查看它。也许我开始的赏金对这里有帮助(有人喜欢赢得 50 个声誉点)吗?
You can open the report file
*.rdl
with an XML editor like Notepad++. Then, search for<DataSets>
and you will find the datasets used in the report.<Fields>
section<Query>
section of each data set you can find<CommandText>
and<QueryParameters>
as shown in the example belowExample:
I didn't find a way to see that in Visual Studio's report editor easily. Maybe the bounty I have started helps here (does someone like to earn the 50 reputation points)?
最初,我不确定为什么 OP 和 @Matt 都直接读取 XML,而不是在 Visual Studio 中编辑查询(我只在极端情况下才采用这种方式)。但现在我认为您可能已经失败了 缺少“报告数据”的受害者窗格。
像平常一样在 Visual Studio BIDS 中打开报告,然后从“视图”菜单中选择“报告数据”。如果它不存在,请单击报表画布上的任意位置,它就会出现。在出现的“报告数据”窗格中,您对数据源(数据来自哪里?)和数据集(查询、参数、表达式是什么?)感兴趣。
Initially, I was not sure why both the OP and @Matt are reading the XML directly instead of editing the query in Visual Studio (I only resort to that in extreme cases). But now I think you might have failed victims of the missing "Report Data" pane.
Open the report in Visual Studio BIDS like normally, then from View menu select "Report Data". If it's not there, click on the report canvas anywhere, then it should appear. In the "Report Data" pane that will appear, you're interested in Data Sources (where's the data coming from?) and Datasets (what are the queries, parameters, expressions?).