Is it possible to use the datasource of an ssrs report inside of the custom code section. I want to utilize the same connection as the report to return other data from the same connection, but a different query.
Ex:
Report datasource name = ds
function test() as string
test = ds.connectionstring
end function
Microsoft DevelopmentMicrosoft SQL Server 2008SSRS
Last Comment
pmeharry
8/22/2022 - Mon
itcouple
Hi
Code cannot talk to neither data sources nor data sets.
What are you actually trying to achieve?
Regards
Emil
pmeharry
ASKER
Due to reasons outside my control I cannot create temp tables or temp functions. I want to write a query like:
select apptid, time, place, whoid
where there may be several whoid's.
so I would normally write
select apptid, time, place, getwho(apptid)
which would return something like
CREATE FUNCTION #GetWho(@apptid int)
RETURNS VarChar(300)
AS
BEGIN
DECLARE @Names varchar(1000)
DECLARE @Name varchar(400)
DECLARE c CURSOR for
select name
from table t
where t.id = @apptid
OPEN c
Fetch Next FROM c into @Name
While @@FETCH_STATUS = 0
Begin
If @Names is null
set @Names = @Name
else
set @Names = @Names & ', ' & @Name
End
Close c
Deallocate c
set @Names = substring(@names, 1, 300)
RETURN @Names
END
pmeharry
ASKER
Forgot my context. This is a TSQL function. The VB Code would
have to make a connection using the connnection from the report first.
THen implement a function somewhat similar to this one.
Code cannot talk to neither data sources nor data sets.
What are you actually trying to achieve?
Regards
Emil