c# - Ado.net running SQL Server stored procedure can't retrieve output value when using ExecuteReader -


param.add(new sqlparameter("@count", sqldbtype.int) { direction = parameterdirection.output });  using(var dataset = mssqlhelper.executedataset(sqlconn.conn, commandtype.storedprocedure, "getlist", param.toarray())) {     // count.value not null }  using (sqldatareader dr = mssqlhelper.executereader(sqlconn.conn, commandtype.storedprocedure, "getlist", param.toarray())) {     // count.value null     } 

there output value in stored procedure.

if use executereader, value of param count null. if change method executereader executedataset, can value of count.

why there no value when use executereader?

by way, nothing has changed in example except executedataset / executereader.

you should check output parameter value after reader has been closed (i.e. after using block), or after reading end of data. see this kb article.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -