开发者

ADO Data Types (adParamInput vs adParamOutput)

开发者 https://www.devze.com 2023-04-12 21:07 出处:网络
Can somebody please tell me what the difference is between adParamInput and adParamOutput? I\'m using parameters in a Classic ASP/MySQL environment.

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开发者_如何学Go


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.


The output from a SELECT query (a.k.s. a "resultset") must be captured in ADO using a Record or Recordset object.

Parameters of type AdParamOutput are used to return scalar values from a stored procedure.

Parameters of type AdParamInput are used to pass values, typically (though not necessarily) scalar, to a stored proc or prepared statement.

To return the number of rows affected by an update statement (e.g. INSERT), use the RecordsAffected property on the Connection/Command object's Execute method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号