none
3-tiers + ReportViewer RRS feed

  • Question

  • I'm sure this has been answered already, but a quick search did not yeild anything helpful. If this has already been answered elsewhere, I would appreciate it if you could provide links to the solution(s).

    We are currently working with a solution in VS2005 that consists of 3 projects (1 web project + 2 libraries - a Business-Logic layer and Domain model) and are new to using the ReportViewer control.

    Our Business Objects (BO) in our Business-Logic layer are properly annotated as such and work perfectly with the ObjectDataSource controls but do not show up as DataSources when we attempt to design our local reports (*.RDLC files) in the web project. Everything that we have found that talks about using your own BO's within a web project involves the BO's residing in the App_Code folder of the web project and not in a seperate project (assembly). It appears that the only choice we have at design time is to create a DataSet and use that, but that would bypass all of the logic in our BO's.

    The *.ASPX pages that the ReportViewer control resides on needs an ObjectDataSource that supplies data in the same format as was specified during report design, so we can easily use our BO's without a problem. My problem is how do I design my report against my BO's??

    Thanks in advance for any help you can provide.
    Monday, September 10, 2007 3:30 PM

All replies

  • This may not be the best answer but it is how I do it:

     

    I create a little stub set of data using literal values in correct types -- I write it to an ADO.NET-schema-style set of XML files.  I do it directly, but you can do it by loading up a dataset however you want and writing out the XML.  Make sure you have every value filled out (no nulls).

     

    Now these XML files can serve as data sources for design purposes.  You just need data that *looks* like those data sources, they don't have to be *from* those data sources, IOW.

     

    It's possible to do the same thing by using a SELECT of literal values in the correct types, without the files, I think.  I can't walk through the steps right now but if you are still having trouble I will give it a shot later.

     

    >L<

     

     

     

    Monday, September 10, 2007 4:20 PM
  •  Lisa Nicholls wrote:

    This may not be the best answer but it is how I do it:

     

    I create a little stub set of data using literal values in correct types -- I write it to an ADO.NET-schema-style set of XML files.  I do it directly, but you can do it by loading up a dataset however you want and writing out the XML.  Make sure you have every value filled out (no nulls).

     

    Now these XML files can serve as data sources for design purposes.  You just need data that *looks* like those data sources, they don't have to be *from* those data sources, IOW.

     

    It's possible to do the same thing by using a SELECT of literal values in the correct types, without the files, I think.  I can't walk through the steps right now but if you are still having trouble I will give it a shot later.

     

    >L<



    I would really prefer not creating a DataSet for the sole purpose of designing the report, since it will serve no purpose after the report has been designed. The compiler will also add useless auto-generated code/classes to my web projects assembly due to the existance of the DataSet. If you can show me another way I would appreciate it.

    I have downloaded an example project using Business Objects from the GotReportViewer.com website, looked at the RDLC file (as XML), and noticed that it appears to have a 'dummy' DataSet and/or DataSource defined within it. I'll pursue this option in the meantime.
    Monday, September 10, 2007 9:00 PM
  • >>

    I have downloaded an example project using Business Objects from the GotReportViewer.com website, looked at the RDLC file (as XML), and noticed that it appears to have a 'dummy' DataSet and/or DataSource defined within it. I'll pursue this option in the meantime.
    <<

     

    Um, I believe this is what I was telling you to do <s>.

     

    You don't have to "create a dataset" and you don't have to have the auto-generated classes in your web projects.

     

    Here is what I do (really -- I hope I don't miss a step, but it's pretty simple):

     

    * -- with the RDLC open I choose Reports on the menu, DataSources... under that

     

    * -- I pick "Add New Data Source".

     

    * -- I pick *any* connection and *any* table, it really doesn't matter what.

     

    * -- I save that.  Then I pick "Edit DataSet with Designer" and choose to "configure" the item that's there. There is a completely useless SELECT statement there, which I replace with the SELECT <literal values> of my choosing to represent the real data.  For example:

     

    SELECT 1 AS Field1, 'Test' AS Field2

     

    ... now I can drag the items from the dataset to the Report Designer window.  Isn't that what you wanted to do?

     

    If you look in the RDLC (XML) at this point you will see that "dummy" dataset you were  talking about...

     

    You can delete the XSD later if you want, or just move it out of the project ...

     

    >L<

     

     

     

     

     

     

    Monday, September 10, 2007 9:32 PM