none
How do I create a report based on a stored procedure that returns a table? RRS feed

  • Question

  • I have some stored procedures that return cross tab queries in table form and would like to create some reports based on these. How do I best accomplis this?
    Monday, July 26, 2010 7:14 PM

Answers

  • Hi....Wasabi_Sushi

     

    In Data Sources Window,

    1) Add New DataSource

    2)Select DataSource as DataBase

    3)Choose or Create ConnectionString to your DataBase

    4)Choose Your Database Objects (if you want to retrive data from stored Procedure then select that Stored Procedure)

    5)Click on Finish Button

    6)One Xsd file will be added to your project(Class Library).

    7)Double click on it. It will Dispaly Your selected Store Procedure with Data Adapter Name

    8) In Code Behind Just Create and object of Data Adapter and Fill the DataTable.

    9) Now asign DataTable which you have filled with data as DataSource of your BindingSource(BindngSource.DataSource = DataTable)

    Best of Luck

     

    • Marked as answer by Wasabi_Sushi Wednesday, July 28, 2010 4:46 PM
    Wednesday, July 28, 2010 1:14 PM

All replies

  • Hi....Wasabi_Sushi

     

    In Data Sources Window,

    1) Add New DataSource

    2)Select DataSource as DataBase

    3)Choose or Create ConnectionString to your DataBase

    4)Choose Your Database Objects (if you want to retrive data from stored Procedure then select that Stored Procedure)

    5)Click on Finish Button

    6)One Xsd file will be added to your project(Class Library).

    7)Double click on it. It will Dispaly Your selected Store Procedure with Data Adapter Name

    8) In Code Behind Just Create and object of Data Adapter and Fill the DataTable.

    9) Now asign DataTable which you have filled with data as DataSource of your BindingSource(BindngSource.DataSource = DataTable)

    Best of Luck

     

    • Marked as answer by Wasabi_Sushi Wednesday, July 28, 2010 4:46 PM
    Wednesday, July 28, 2010 1:14 PM
  • I can create the data source just fine. The problem is that in the report creation wizard, the "Query Designer" does not show stored procedures. It only shows Tables, Views, Functions, and Synonyms. I thought I had created a report based on a stored procedure prior to upgrading to SQL Server 2008 R2 and Visual Studio 2009, but I can't find where I hid that project and it would probably be built for VS 2005.

    Wednesday, July 28, 2010 1:37 PM
  • OK I bagged the wizard and just entered the SQL command EXECUTE sp_MyProc and it seemed to work. I guess it pays to just do some things without the wizards.
    Wednesday, July 28, 2010 1:58 PM
  • Hi

    Hiren

    Can you plz elaborate last two points?

    Tuesday, September 20, 2011 12:34 PM