You are viewing limited content. For full access, please sign in.

Question

Question

Why I Couldn't receive value of parameter from stored procedure ?

asked on December 1, 2014

I code a stored procedure reason for return count of rows from a table.

Here is my code.

USE [MTechTables]
GO
/****** Object:  StoredProcedure [dbo].[sp_PCVLimitbyAccount]    Script Date: 12/01/2014 15:01:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 ALTER PROCEDURE [dbo].[sp_PCVLimitbyAccount] @AccountName nvarchar(50)
AS
 BEGIN

 Declare @myTable table
 (
 [paramApprovedDate] nvarchar(12),
 [paramLimit] float,
 [paramAddupPoint] float,
 [paramCurrentLimit] float,
 [paramTempCurrentLimit] float,
 [paramApprovedName] nvarchar(100),
 [paramPosition] nvarchar(100),
 [paramAdminAmount] float,
 [paramAccountName] nvarchar(50),
 [paramComments] nvarchar(max),
 [paramFound] nvarchar(20)
 
 ) 
 Declare @paramCount int
 Begin
 
    insert into @myTable select ApprovedDate,Limit,AddupPoint,CurrentLimit,TempCurrentLimit,ApprovedName,Position,AdminAmount,AccountName,Comments,N'มีข้อมูลแล้ว' from dbo.PCLimit where EditedDate = (select max(EditedDate) from PCLimit where AccountName = @AccountName) and AccountName = @AccountName;
    select *  from @mytable
    select @paramCount = (select count(*) from @mytable)
 End
  
 END

The issue is when I refer to @paramCount in lookup rule page(in attached file) I couldn't receive the count of row as I wish.Any way no error appeared when executed this stored procedure.

I wonder How to refer to this parameter or did I miss something?

Thank you in advance.

 

parameter_stored_procedure.png
0 0

Answer

SELECTED ANSWER
replied on December 1, 2014

Forms currently only support one result set for a stored procedure. And in your case there are 2 select which will have 2 result sets. You may need to create 2 stored procedure(one select the columns, one select the count) to archive this.

1 0

Replies

replied on December 2, 2014

Thank you very much for your answer

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.