my blog RSS 2.0
 Friday, June 11, 2004

In my previous post I stated that I had succeeded in converting a Reporting Services Data Processing Extension for reporting on ad-hoc data from a serialized ADO.Net DataSet into VB.Net. I have since extended this with an extra parameter (IDataParameterCollection) to allow the report designer to define at design-time (or indeed at run-time) which DataTable within the DataSet should be used as the source table. The implementation of DataProcessing.IDataReader also now iterates over a DataView of the table rather than the DataTable itself thus allowing me to pass a third parameter (actually passed via the Generic Query Designer as the command text (IDbCommand.CommandText)) which I then use as the RowFilter for the DataView.

This all works great. I can supply the parameters which I have told the extension to request from the designer (via the implementation of IDbCommandAnalysis.GetParameters method), and the query designer screen returns the data into the results screen, but if I attempt to navigate to the report layout tab, or I click on the 'Refresh Fields' button within the Generic Query Designer, I get an exception.

I deliberately decided to Debug.Assert that the @DataSource parameter should not be empty, but it should not be empty anyway as I have already supplied it via the designer. Following my debug trace information I can see that ExecuteReader in being called, but that the parameters are being passed as empty strings. If I elect to ignore the error then I can see via the trace that ExecuteReader gets called a second time, this time passing the parameters as I have entered them, and all is well.

The solution of course is not to require there to be non-empty parameters, but surely this is a bug?

UPDATE: after lots more detective work I have discovered that presumably the Report Designer graciously handles any ArgumentExceptions, and just carries on and attempts the ExecuteReader a second time.

How did I discover this? I turned off my assertions and just let the code proceed, the code gets as far as trying to load the DataSet:

Try
  
dataset.ReadXml(dataSource)
Catch ex As
System.Exception
   Trace.WriteLine(
String
.Format("Error Reading XML into dataset: {0}:{1}", ex.Message, ex.GetType))
   Throw
ex
End Try

but inevitably it fails because the dataSource parameter is a blank string, so I catch an ArgumentException and write a message to the trace as follows:

Error Reading XML into dataset: The path is not of a legal form.:System.ArgumentException

The Report Designer then carries on and repeats the call to ExecuteReader, this time passing the correct parameters and everything goes smoothly.

So, still a bug in my opinion (unless anyone can enlighten me otherwise) - but it works! ;-)

UPDATE 2:

Robert Bruckner has now kindly enlightened me as follows (see also this thread):

If you actually execute the query when ExecuteReader(SchemaOnly) is called
then the implementation is incorrect. For SchemaOnly execution, no parameter
values are passed in because no query should be executed - just the columns
should be returned.

When Refreshing Fields, the report designer first tries to determine the
fields based on ExecuteReader(SchemaOnly) because this should not affect any
database state (and it is cheaper). If SchemaOnly fails, then report
designer tries to actually execute the query and determine the fields based
on the returned dataset. In order to execute the query it has to pass in
parameter values.

Friday, June 11, 2004 4:37:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [3] -
Reporting Services
Friday, February 25, 2005 11:35:36 AM (GMT Standard Time, UTC+00:00)
Bryan's WebLog
Friday, February 25, 2005 11:35:36 AM (GMT Standard Time, UTC+00:00)
Rohan,
<br>
<br>I can't seem to find anywhere to download you VB version of the DPE. The gotdotnet site say's it's not available. Is there any chance you could email over a copy.
<br>
<br>Many Thanks
<br>Toby
<br>
<br>mailto:toby.maillist@exmlsystems.com
<br>
Toby
Friday, February 25, 2005 11:35:36 AM (GMT Standard Time, UTC+00:00)
I have now updated the submission to GotDotNet
Rohan Cragg
All comments require the approval of the site owner before being displayed.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Archive
<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Rohan Cragg
Sign In
Statistics
Total Posts: 24
This Year: 0
This Month: 0
This Week: 0
Comments: 42
Themes
Pick a theme:
All Content © 2008, Rohan Cragg
DasBlog theme 'Business' created by Christoph De Baene (delarou)