[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Obtaining SQL query from an rdlc file

hcurrie

9/11/2008 9:27:00 AM

The rdlc file contains the sql query needed to generate the report, but I
can't see any way to access this information through the LocalReport class
or the ReportViewer control. Can anyone suggest what might be the best way
to get this information? I think the rdlc file is in xml format, so I could
probably do it using an XmlReader, but as I am already loading it using the
ReportViewer control I wondered if there was a way of accessing it though
there somehow.

TIA
Phil.


4 Answers

v-alchen

9/12/2008 7:35:00 AM

0

Hi Phil,

==================================================
I think the rdlc file is in xml format, so I could
probably do it using an XmlReader, but as I am already loading it using the
ReportViewer control I wondered if there was a way of accessing it though
there somehow.
==================================================
You're correct that the rdlc file is in xml format. But ReportViewer
control is just a UI to display the report. It has no responsibility to
know how the data is retrieved.

The logic how the report works is like this.
1. The ReportViewer control asks the ObjectDataSource for data.
2. The ObjectDataSource get data by calling the Select method defined in
the Adapter class of the strongly typed DataSet. Then, ObjectDataSource
pass data to the ReportViewer.
3. The ReportViewer check the rdlc to get the information as to what fields
should be displayed and how to display them.
4. Then ReportViewer send the report back to the client.

So actually it's the Adapter class that is responsible for querying
database. You can remove or change the SQL query in the rdlc file (open it
with Notepad), it should still show the fields as normal.
So in my opinion, the best option is to read the rdlc file directly (for
example, using XmlReader, as you said). But the prerequisite is that you
didn't change the SQL query stored in the rdlc file.

Please let me know if you have further questions.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#not....

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&am....
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| NNTP-Posting-Date: Thu, 11 Sep 2008 04:27:10 -0500
| From: "Phil" <N/A>
| Newsgroups: microsoft.public.dotnet.framework
| Subject: Obtaining SQL query from an rdlc file
| Date: Thu, 11 Sep 2008 10:27:09 +0100
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
| Message-ID: <H66dneRfYfnzeVXVRVnyiQA@posted.plusnet>
| Lines: 12
| X-Usenet-Provider: http://www.gi...
| X-Trace:
sv3-N7XjE331dWyzYnuN7uNSAsqNNA+7nFgdinqUS1E/8Bpt2Yeb5zXcwr3bxG9ZP4FDhbjfT6lG
logPMLJ!SbtOWdr/5GfcQ93p4itkTtyuHSSbY5eg71Xsy3EQmjL08vBsElf5b+E6qzBctU9GVkz9
eJJSnA==
| X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
| X-Postfilter: 1.3.39
| Bytes: 1565
| X-Original-Bytes: 1501
| Path:
TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS02.phx.gbl!TK2MSFTFE
EDS01.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!border2.nntp.dca.gigane
ws.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giga
news.com!nntp.posted.plusnet!news.posted.plusnet.POSTED!not-for-mail
| Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework:16122
| X-Tomcat-NG: microsoft.public.dotnet.framework
|
| The rdlc file contains the sql query needed to generate the report, but I
| can't see any way to access this information through the LocalReport
class
| or the ReportViewer control. Can anyone suggest what might be the best
way
| to get this information? I think the rdlc file is in xml format, so I
could
| probably do it using an XmlReader, but as I am already loading it using
the
| ReportViewer control I wondered if there was a way of accessing it though
| there somehow.
|
| TIA
| Phil.
|
|
|

Allen Chen-MSFT

9/15/2008 9:51:00 AM

0

Hi Phil,

==================================================
I think the rdlc file is in xml format, so I could
probably do it using an XmlReader, but as I am already loading it using the
ReportViewer control I wondered if there was a way of accessing it though
there somehow.
==================================================
You're correct that the rdlc file is in xml format. But ReportViewer
control is just a UI to display the report. It has no responsibility to
know how the data is retrieved.

The logic how the report works is like this.
1. The ReportViewer control asks the ObjectDataSource for data.
2. The ObjectDataSource get data by calling the Select method defined in
the Adapter class of the strongly typed DataSet. Then, ObjectDataSource
pass data to the ReportViewer.
3. The ReportViewer check the rdlc to get the information as to what fields
should be displayed and how to display them.
4. Then ReportViewer send the report back to the client.

So actually it's the Adapter class that is responsible for querying
database. You can remove or change the SQL query in the rdlc file (open it
with Notepad), it should still show the fields as normal.
So in my opinion, the best option is to read the rdlc file directly (for
example, using XmlReader, as you said). But the prerequisite is that you
didn't change the SQL query stored in the rdlc file.

Please let me know if you have further questions.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#not....

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&am....
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


"Phil" wrote:

> The rdlc file contains the sql query needed to generate the report, but I
> can't see any way to access this information through the LocalReport class
> or the ReportViewer control. Can anyone suggest what might be the best way
> to get this information? I think the rdlc file is in xml format, so I could
> probably do it using an XmlReader, but as I am already loading it using the
> ReportViewer control I wondered if there was a way of accessing it though
> there somehow.
>
> TIA
> Phil.
>
>
>

hcurrie

9/15/2008 10:56:00 AM

0

> You're correct that the rdlc file is in xml format. But ReportViewer
> control is just a UI to display the report. It has no responsibility to
> know how the data is retrieved.

OK. Thanks. I just wondered as the LocalReport class was reading this file,
whether it is possible to access what it has loaded. If it just ignores the
sql, and doesn't provide any mechanism to access it, I guess I need to read
this separately myself.

>
> The logic how the report works is like this.
> 1. The ReportViewer control asks the ObjectDataSource for data.
> 2. The ObjectDataSource get data by calling the Select method defined in
> the Adapter class of the strongly typed DataSet. Then, ObjectDataSource
> pass data to the ReportViewer.
> 3. The ReportViewer check the rdlc to get the information as to what
> fields
> should be displayed and how to display them.
> 4. Then ReportViewer send the report back to the client.

I'm trying to eliminate step 2 once the report has been developed, so that
when I add a new report, I don't need to add any new code, just provide the
new rdlc file.

> So actually it's the Adapter class that is responsible for querying
> database. You can remove or change the SQL query in the rdlc file (open it
> with Notepad), it should still show the fields as normal.
> So in my opinion, the best option is to read the rdlc file directly (for
> example, using XmlReader, as you said). But the prerequisite is that you
> didn't change the SQL query stored in the rdlc file.

Once the report has been developed, I no longer need the the strongly typed
dataset and adapter. I plan to read the SQL from the rdlc file, and use this
with a generic Dataset object as the datasource.
I will have one project in which I will develop the reports, but when I want
to implement this in the main application, all I need to do is distribute
the rdlc file, as the generic code in the main application can get
everything it needs from there.



donie

10/5/2009 9:06:00 AM

0

>>\"SOLOMON TEMPLE IS THE HEART AND SOUL OF FREEMASONRY wrote:
>> Apakah nabi Isa (Yesus) lupa "memperhitungkan semua dalam menciptakan,
>> dan sudah
>> pula di tentukan umur Dunia dan Manusia." Mengapa nabi Isa tak berikan
>> ajaran semacam itu,
>
> 43. Az Zukhruf
> 61. Dan sesungguhnya Isa itu benar-benar memberikan pengetahuan
> tentang hari kiamat. Karena itu janganlah kamu ragu-ragu tentang
> kiamat itu dan ikutilah Aku. Inilah jalan yang lurus.
>
> 61. Ash Shaff
> 6. Dan (ingatlah) ketika Isa ibnu Maryam berkata: "Hai Bani Israil,
> sesungguhnya aku adalah utusan Allah kepadamu, membenarkan kitab
> sebelumku, yaitu Taurat, dan memberi khabar gembira dengan (datangnya)
> seorang Rasul yang akan datang sesudahku, yang namanya Ahmad
> (Muhammad)." Maka tatkala rasul itu datang kepada mereka dengan
> membawa bukti-bukti yang nyata, mereka berkata: "Ini adalah sihir yang
> nyata."

Kenapa anda percaya apa nyang disampaikan oleh ayat yang anda kutip itu?