Cannot create ReportViewer with Stored Procedure, as no fields found in report.rdlc table?!

Posted on 2012-09-16
Last Modified: 2012-09-19
I'm trying to create ReportViewer which will show data select from database with stored procedure. Below is code of stored procedure which works fine if execute it.
I have done next things:
Add new Form1, and ReportViewer control >> add new dataset1 >> drag/drop stored procedure into dataset1 space, so I've got DataTable & TableAdapter. Into DataTable I have manually create columns which are select from stored procedure, like FirstName & SecondName. TableAdapter contain stored procedure query Fill with parameter @TableName. >> In Report1.rdlc I have add table, and add stored procedure GetTables as datasource. >> For ReportViewer control, I have select Report1.rdlc, and by that I've got GetTablesBindingSource & GetTablesTableAdatper. >> then finally want to design columns in Reprot1.rdlc, but no fields found it, like <No Fields> ?!

I have already done a few report, but only with specific table, and not to load report with different tables.
I would be very pleased if someone could help me here, give a tips, etc.

@TableName varchar(50)
declare @GetTables varchar(max)
set @GetTables = 
SELECT FirstName, SecondName
FROM ['+ @TableName +']
exec (@GetTables)

Open in new window

Thanks in advance for help!
Question by:dejandejanovic
    1 Comment
    LVL 83

    Accepted Solution

    >In Report1.rdlc I have add table, and add stored procedure GetTables as datasource.

    You need to select that data table as the data source of the report.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now