I have a project using ASP.Net MVC 3 and now I’m creating a report for my project. I have several reports in my project and all of them are using stored procedures. For creating a report in MVC 3, first I create a new dataset. I have trouble with one of my reports. I have a procedure like this (named SP_Rpt) :
CREATE TABLE #temp_batch (batch_id VARCHAR(20))
EXEC SP_StrListToTable @batchId, ',', #temp_batch
select Batch_Id, Batch_Date
from Batch
where Batch_Id in (select * from #temp_batch)
and isnull(Payment_Decline_Date,'') = '' and Payment_Amount > 0
and Batch_Open = 0 and Invoice_Paid_Amt > 0
when I try to add new table adapter using SP_Rpt I get this error:
The wizard detected the following problems when configuring the TableAdapter: “SP_Rpt”
Details:
Generate SELECT statement invalid object name ‘#temp_batch’
To add These components to your dataset, click Finish.
I click finish and there’s no column in my table adapter. But I can to preview data. And when I create Report and choose that dataset, I don’t have any column (I can’t design new report). Is there something wrong with my procedure (I don’t think so, because I can preview data) ? How to list column in my data set using that stored procedure ?
thanks
Put the following at the beginning of the stored procedure:
Retrieve fields schema in Visual Studio of stored procedure which uses temp tables