简体   繁体   中英

How to get result set of a stored procedure using a temp table while creating .xsd in reportsapplication

I have a stored procedure in SQL Server which runs correctly, I need to use the table returned by it as my data for my report in .rdlc format.

EXEC my_stored_procedure @name, @begindate, @enddate

The stored procedure starts like:

BEGIN
    DECLARE ...some variables..

    IF OBJECT_ID('tempdb..#proptbl') IS NOT NULL
        DROP TABLE #proptbl

END

I am trying to add a dataset using an .xsd to my Report Application in SQL Server Data Tools 2015.

I've created the .rdlc and need to add an .xsd and connect to rdlc.

I added .xsd to the project, added a "table adapter" in it, connected to my database, selected "Use Existing Stored Procedure" as command type, set my procedure in the "select" segment (parameters are not coming, see picture below), check "Fill a datatable" and "Return a datatable". At this point when I click next button, I am get this error:

在此处输入图片说明

So there is no data returned. Stacked here, any help would be appreciated. Thanks.

在此处输入图片说明

Found my answer here: TableAdapter Configuration Wizard doesn't like temp tables in SP

Adding this after "AS" keyword at the beginning of the SP helped:

IF 1=0 BEGIN
    SET FMTONLY OFF
END

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM