I am trying to display a report that is generated by executing a stored procedure. The student table is defined as follows:
The stored procedure is defined in the database like this:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetStudentInfo]
@StudentName NVARCHAR(50)
AS
BEGIN
SELECT *
FROM Students
WHERE Students.Name = @StudentName
END
The data source has been defined accordingly, and a variable has been set to pass as an argument to the stored procedure.
EXEC GetStudentInfo @StudentName
However, it appears that the variable StudentName
is not being properly passed to the stored procedure, causing it to not work correctly.
The preview tab:
And result in SQL Server profiler:
declare @p1 int
set @p1=12
exec sp_prepexec @p1 output,N'@StudentName varchar(50)',N'EXEC GetStudentInfo @StudentName
',@StudentName=NULL
select @p1
1条答案
按热度按时间2mbi3lxu1#
I was able to retrieve a report from a stored procedure using Stimulsoft by defining a select query and adding a variable to capture user input. Here's an example of how I achieved this:
In this case, @StudentName is the variable that captures the user input."