User152990470 posted
Good day. I have the following problem. In my asp.net 4.0 web system there is a stored procedure that puts together a sql string based on a users privilages (stored in a session variable session("priv") ) and then executes this string to return
results.
set @iwherestring = (SELECT dbo.filterstring('o.depot', 'Depot' ,@priv))
SET @SQLString = N'select o.orderno,i.itemNo,o.clientCode, o.orderdate, o.depot , i.product, i.amount from orders o join order_items i on o.orderno = i.orderno and o.clientCode = i.clientCode ' + @iwherestring;
EXECUTE sp_executesql @SQLString
The procedure works perfectly when called from withing SSMS but when i try to attach the stored procedure to the datasource of a reportviewer control it does not work. Is this becaue i am putting the sql together dynamically?
Any help would be greatly appreciated!