Representing the Results of a Stored Procedure

From RAD Studio
Jump to: navigation, search

Go Up to Specifying What Data to Display

Stored procedures are sets of SQL statements that are named and stored on an SQL server. How you indicate the stored procedure you want to execute depends on the type of unidirectional dataset you are using.

When using Data.SqlExpr.TSQLDataSet, to specify a stored procedure:

  • Set the CommandType property to ctStoredProc.
  • Specify the name of the stored procedure as the value of the CommandText property:
SQLDataSet1.CommandType := ctStoredProc;
SQLDataSet1.CommandText := 'MyStoredProcName';
SQLDataSet1->CommandType = ctStoredProc;
SQLDataSet1->CommandText = "MyStoredProcName";

When using Data.SqlExpr.TSQLStoredProc, you need only specify the name of the stored procedure as the value of the StoredProcName property.

SQLStoredProc1.StoredProcName := 'MyStoredProcName';
SQLStoredProc1->StoredProcName = "MyStoredProcName";

After you have identified a stored procedure, your application may need to enter values for any input parameters of the stored procedure or retrieve the values of output parameters after you execute the stored procedure. See Working with Stored Procedure Parameters for information about working with stored procedure parameters.

See Also