Crystal Reports 不显示存储过程输出

我在 SQL Server 中创建了一个存储过程.它在那里工作得很好.

I created a stored procedure in SQL Server. It works fine there.

当我从 Crystal Reports 调用它时,它会显示参数字段,但不会显示数据库字段中的输出.实际上它在数据库字段中显示存储过程,而不是在存储过程旁边的输出字段或+号.

When I call it from Crystal Reports, it shows parameters fields but it does not show the outputs in database fields. Actually it shows the stored procedure in database fields but not the output fields or + sign beside the stored procedure.

这是存储过程中的代码:

Here is the codes in stored procedure:

CREATE PROCEDURE [test]
           @mcode char(10),
           @zcode [int], 
           @odolmas[float]=0 output,
           @gmas[float]=0 output,
           @vmas[float]=0 output          
AS
       set @gmas=0
       set @vmas=0
       set @gmas=9
       set @vmas=5

       set @odolmas=((@vmas-@gmas)/2)
GO

在 Crystal Reports 中,我可以看到 @mcode@zcode 作为输入参数.但我看不到 @gmas@vmas@odolmas 作为输出.

In Crystal Reports I can see the @mcode and @zcode as input parameters. But I cannot see @gmas, @vmas and @odolmas as outputs.

请帮我做,因为我不专业,请一步一步说我该怎么做

Please help me do it and because I am not professional please say it step by step what should I do

谢谢

推荐答案

当我们执行您问题中显示的存储过程时,我们不会得到任何输出.尝试在存储过程中使用 select 语句,水晶报表会看到返回值.

When we execute the stored procedure shown in your question, we won't get any output. Try using the select statement inside your stored procedure, the return values will be seen by crystal report.

比如说在你的程序最后选择@gmas as Col1,@vmas as Col2,可能会将文件显示为col1和col2.您可以将这些 col1 和 col2 放在您的报告中以进行显示.

Say for example Select @gmas as Col1, @vmas as Col2 in your procedure at the end, may show the fileds as col1 and col2. You can place these col1 and col2 on your report for display purpose.

相关文章