开发者

SqlParameter ParameterDirection

A developer asked me tod开发者_如何转开发ay if there are disadvantages or risks while setting all SqlParameters for a SqlCommand to ParameterDirection.InputOutput. I coudn't think of any expect maybe some performance issues (but not even sure of that)? Someone having experience with that?


There is no risk if the code doesn't attempt to use the values afterwards. However, if code is using the values again then the value may have changed inside the stored procedure. Performance wise, the values are marshalled back from SQL if they are output parameters.

There is no point in doing this really. Not all DBMS support output parameters so you would be increasing coupling for zero gain.


As a developer you should be clearly showing your intent.

If the parameter is not in/out then setting the direction to in/out will only add confusion not value.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜