WebCab Probability and Statistics for .NET v3.3 Demo

ADOMediator.SelectAndUpdate Method (String, String, String, Object, Boolean)

Performs calculations upon a data set and writes the results back to the database, by using a SELECT input query and a stored procedure or an UPDATE/INSERT command.

public void SelectAndUpdate(
   string methodName,
   string inputQuery,
   string outputQuery,
   object resultParameters,
   bool storedProcedure
);

Parameters

methodName
The name of the method used in evaluating the input data returned by inputQuery. If the underlying component contains several methods named meethodName, the one that fits best the number columns returned is chosen.
inputQuery
A SELECT SQL query that returns enough columns to invoke methodName. Every column will be passed on to the method in the order they were queried.
outputQuery
An SQL update/insert query or a stored procedure invoked with each input row, meant to write the results back to the database. If the storedProcedure flag is set, the outputQuery is run as a stored procedure, otherwise this method will treat it as an SQL statement.
resultParameters
Named parameters to assign the results of methodName to. If only one result is expected, pass in a String - the name of the named parameter. If more than one value is supposed to be returned by methodName, pass in a String array representing the names of the IN parameters of the output query. If your driver does not support named parameters, the values of the array returned by methodName will be added in the order of their appearance inside the output query.
storedProcedure
If true, the output query is run as a stored procedure, if false the output query will be invoked as an ordinary SQL statement.

Remarks

Additionally, you should specify the named parameters where to place the results returned by methodName, either as a String, or an array of String objects.

Exceptions

Exception TypeCondition
ADOMediatorExceptionThrown to indicate run-time errors.

Example

The following piece of code invokes method MyMethod by using the SHARES and VALUE columns as parameters. The "@MONEY" named parameter is used to store the result returned by MyMethod.

            ado.SelectAndUpdate ("MyMethod", "SELECT C_ID, SHARES, VALUE FROM TRADES",
                 "UPDATE CUSTOMER SET MONEY=@MONEY WHERE C_ID='00001'",
                 "@MONEY", false);
            

See Also

ADOMediator Class | WebCab.Libraries.Statistics.Hypothesis.ADO Namespace | ADOMediator.SelectAndUpdate Overload List