contents   index   previous   next



Stproc instance properties

 

The properties of Stproc objects vary from instance to instance. Each Stproc object has a property for each parameter in the stored procedure or SQL statement. Thus, when an Stproc object is created, it acquires a property for each of its parameters.

 

Parameters of an Stproc object may also be referred to as elements of an array. The 0-index array element corresponds to the first parameter, the 1-index array element corresponds to the second parameter, and so forth.

 

The following example demonstrates how to call a stored procedure using named parameter properties. A GetCityArea procedure might be defined in a MS Access database as follows:

 

/*

   PARAMETERS AreaParam Text, CityParam Text;

   SELECT Table3.* FROM Table3

   WHERE ((Table3.Area=[AreaParam]) AND

          (Table3.City=[CityParam]));

*/

 

// Recall the Stproc object 'GetCityArea' from the database

sp = db.storedProc("GetCityArea");

 

// Set the parameter values

sp.AreaParam = "Europe";

sp.CityParam = "Paris";

 

// Execute the stored procedure

citySet = sp.cursor();

 

// Clean up

citySet.close();

sp.close();

 

/*

   This example uses the same procedure, but accesses the

   parameters through array indexes.

*/

 

// Recall the Stproc object 'GetCityArea' from the database

sp = database.storedProc("GetCityArea");

 

// Set the parameter values

sp[0] = "Europe";

sp[1] = "Paris";

 

// Execute the stored procedure

citySet = sp.cursor();

 

// Clean up

citySet.close();

sp.close();

 


Stproc instance methods