Search code examples
mysqlsqldatabaseadosqldatatypes

ADO Data Types (adParamInput vs adParamOutput)


Can somebody please tell me what the difference is between adParamInput and adParamOutput?

I'm using parameters in a Classic ASP/MySQL environment.

Many thanks


Solution

  • AdParamInput is for a value sent TO the db, AdParamOutput is for a value returned FROM the db (an an output parameter from a stored procedure for instance) as distinct from the recordset that is returned.

    EDIT: expand answer.

    In and out parameters are used to pass typed scalar values back and forth between the client and the server. So, you might use an input parameter to give the primary key of the record you are looking for, and an output parameter to return a seperate, but related value. For instance, if you had a table of employees, and you wanted to select all of the employees by department, and their combined salary last year. Returning the combined salary in every row of the recordset would be possible, but inconvenient on the client. Instead you return a recordset and set the value of an output parameter. The client extracts the scalar, and then processes the recordset (presenting a list of names and CURRENT salaries, along with how much these people were paid last year). In other cases you might just return the output parameter, without a recordset.