Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics

How to display data returned by stored procedure

Scroll Prev Next More

 

The following SQL Server stored procedure example returns data from the "test" table.

 

CREATE PROCEDURE [dbo].[test_proc]
AS
BEGIN
SET NOCOUNT ON;
SELECT * from test
END

 

1. Add the test table or any other table to the project.

 

2. Add the following code to the List page: CustomQuery event:

 

Set ListQuery=DB_Query( "EXEC test_proc" )

 

3. Add the following code to the List page: FetchRecords event:

 

doAssignmentByRef ListFetchArray,rs.fetchAssoc()

 

4. Add the following code to the ListGetRowCount event:

 

doAssignmentByRef ListGetRowCount, tDAL.DBLookup("select count(*) from test")

See also:

Database API:Query()

DAL method: DBLookup

QueryResult object: fetchAssoc()

Event: ListQuery

Event: ListFetchArray

Event: ListGetRowCount

How to execute stored procedures