kian
kian

Reputation: 19

Run a stored procedure with parameters in stimulsoft report

I am trying to display a report that is generated by executing a stored procedure. The student table is defined as follows:

enter image description here

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.

enter image description here

enter image description here

The preview tab:

enter image description here

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

Upvotes: 0

Views: 392

Answers (1)

kian
kian

Reputation: 19

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:

USE [Student]
EXEC [dbo].[GetStudentInfo] @StudentName

In this case, @StudentName is the variable that captures the user input."

Upvotes: 0

Related Questions