This method returns a collection that can be populated with values you can pass to the ExecuteSQLStatement method as the parameters to send to a stored procedure or you can pass to the GetValuesForField and GetValuesForParameter methods as the default values.

The collection has an AddItem method that expects two parameters: the name of the value object and the value to assign to it.


GetValuesCollection() as Object

Return Value
A collection to hold value objects.

This example is taken from the end of an example in the Select help topic. It calls GetValuesCollection to create a values collection, adds two values to it, and then passes the collection to ExecuteSQLStatement to be used as the parameters for a stored procedure.

Visual FoxPro

if not empty(ldStartDate) and not empty(ldEndDate)
  loValues = toApplication.GetValuesCollection()
  loValues.AddItem('Beginning_Date', ldStartDate)
  loValues.AddItem('Ending_Date',    ldEndDate)

* Execute the desired stored procedure.

  lcSelect = 'exec [Sales by Year]'
  llReturn = not empty(toDatabase.ExecuteSQLStatement(lcSelect, ;
    loValues, tcCursor))


if(startDate != null && endDate != null)
  Values values = SQApplication.GetValuesCollection();
  values.AddItem("Beginning_Date", startDate);
  values.AddItem("Ending_Date", endDate);

  // Execute the desired stored procedure.
  string select = "exec [Sales by Year]";
  bool returnValue = (database.ExecuteSQLStatement(select, 
    values) != String.Empty);


If Not startDate = Nothing And Not endDate = Nothing Then
  Dim values As Values = SQApplication.GetValuesCollection()
  values.AddItem("Beginning_Date", startDate)
  values.AddItem("Ending_Date", endDate)
  ' Execute the desired stored procedure.
  Dim selectString As String = "exec [Sales by Year]"
  Dim returnValue As Boolean = (Database.ExecuteSQLStatement(selectString,
    values) <> String.Empty)
End If

See also

Application Object

© Stonefield Software Inc., 2018 • Updated: 06/06/16
Comment or report problem with topic