Master Detail parameter with SQL Server

Stimulsoft Reports.NET discussion
Post Reply
lutin7812
Posts: 6
Joined: Wed Mar 20, 2019 7:08 pm

Master Detail parameter with SQL Server

Post by lutin7812 »

Hi, I'm trying to make a simple Master Detail Report works with SQL Server.
I've copied the SQLMasterDetail.mrt that works with MSACCESS to run it with SQL Server.
But when I preview the report I get the error: scalar variable "@CategoryID" must be declared.

Master query datasource 'Categories' is:

Code: Select all

SELECT * FROM Categories
Detail query 'Sales_By_Categories' datasource is:

Code: Select all

SELECT * FROM [Products] where CategoryID = @CategoryID
I've declared the

Code: Select all

@CategoryID int 
parameter in the detail datasource to match the PK column of the master datasource.

Any idea on how the master - detail link with parameter should be made to work with SQL Server?
Thank's for help.
Olivier
lutin7812
Posts: 6
Joined: Wed Mar 20, 2019 7:08 pm

Re: Master Detail parameter with SQL Server

Post by lutin7812 »

I found the problem: you must specify in the detail datasource parameter expression, the name of Master column name key eg. MaterTtable.PkColumnName.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Master Detail parameter with SQL Server

Post by Andrew »

Hello,

Thank you for sharing your solution.
Post Reply