问题
There are 2 Tables on Two Different Servers, I Have Dataset1 pointing to Server1. Similarly I have Dataset2 Pointing to Server2.
Now I want to Use some Values from Dataset1 in Dataset2.
Dataset1:-
Select * from Table1
This has Name,Lessthan,GreaterThan
Dataset2:-
Select * from TableX X inner join Dataset1 on Dataset1.name=TableX.name
Where X.Time>Dataset1.Lessthan and X.Time>Dataset1.GreaterThan
Have tried doing the same as above but we are not able to Access the contents of Dataset1 in Dataset2
It Throws error As 'Invalid Object :-Dataset1'
Please guide me on this.
回答1:
You're right: a Dataset's query can't access another Dataset: the query is sent to the database server, which knows nothing of your other Dataset which is defined in the report only.
You can make some report parameters (which can be hidden from the user), which use your Dataset 1 to provide their values.
Then you can pass the parameter values to Dataset 2: when you open Dataset 2's properties you will see 'Parameters' on the left. In Dataset 2's query, include things like @paramvalue, and you will be able to supply it with your values from your report parameters.
来源:https://stackoverflow.com/questions/44917858/accessing-one-dataset-in-another-dataset-ssrs