http://forum.stimulsoft.com/viewtopic.p ... t=10#p5910
My query uses both varables from the user and from the code.Please declare a variable "ClientListId" in the report's Dictionary. Type of the variable please set 'object'.
SQL query should like something like this:
select * from Categories where CategoryID in ({ClientListId})
report.Load(....); //Load Template
report.Compile();
report["ClientListId"] = "1, 2, 3, 4";
report.Show();
I have noticed that when opening the report in the MVC Viewer a correct query is being executed, but when the user submits his variables from the viewer the query sent becomes this:
..while it should be this:declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,N'@grpID int,@FromDate datetime,@ToDate datetime',N'SELECT COUNT(*) as cnt
FROM MyTable
LEFT JOIN MyTable2 ptc
ON doc.IdDocument=ptc.IdDocument
WHERE doc.IdDocumentType=3 AND doc.IssueDate>=@FromDate AND doc.IssueDate<=@ToDate AND ptc.IdOrgGroup IN (System.Object)
',@grpID=0,@FromDate='2010-12-01 12:13:22',@ToDate='2013-12-09 12:13:22'
select @p1
Am I missing something?declare @p1 int
set @p1=4
exec sp_prepexec @p1 output,N'@grpID int,@FromDate datetime,@ToDate datetime',N'SELECT COUNT(*) as cnt
FROM MyTable
LEFT JOIN MyTable2 ptc
ON doc.IdDocument=ptc.IdDocument
WHERE doc.IdDocumentType=1 AND doc.IssueDate>=@FromDate AND doc.IssueDate<=@ToDate AND ptc.IdOrgGroup IN (22,32)
',@grpID=0,@FromDate='2013-12-09 12:18:53.203',@ToDate='2013-12-09 12:18:53.203'
select @p1
Why does it work the 1st time and not when the user submits his variables (@grpID,@FromDate,@ToDate)?
Should I have anything more in my "interaction" Controller Action other than this? :
Code: Select all
return StiMvcViewer.InteractionResult(HttpContext);