How to get the OutPut Parameter?
-
Hai, Any body can help me by telling How I can get the out put parameter value of the stored procedure which is executing as ExecuteReader. How I can get the value in ADO.NET. In Query analyser I am getting the value by 'select @msg'. Thanks very much. Thank You, Rahul.P.Menon
-
Hai, Any body can help me by telling How I can get the out put parameter value of the stored procedure which is executing as ExecuteReader. How I can get the value in ADO.NET. In Query analyser I am getting the value by 'select @msg'. Thanks very much. Thank You, Rahul.P.Menon
-
Add the parameter to the command object and set the direction to output. After you have executed the procedure, you can read the value from the parameter object. --- b { font-weight: normal; }
Hai Guffa, Thanks a lot for the response. But her I am not creating any command object. Using the written class i am executing sp like
SqlHelper.ExecuteReader(CustomConnString,DatabaseOwner & ObjectQualifier & sp_name,ouputpaaram)
I am using sqlDataReader to get the records. Then how I can proceed.? Where I can add the parameter and read value? If I get more clarification on this that will be really helpful.Thanks very much. Thank You, Rahul.P.Menon. -
Hai, Any body can help me by telling How I can get the out put parameter value of the stored procedure which is executing as ExecuteReader. How I can get the value in ADO.NET. In Query analyser I am getting the value by 'select @msg'. Thanks very much. Thank You, Rahul.P.Menon
if u use select statement then use a datareader. DataReader dr = sql.ExecuteReader() while(dr.read()) { msg = dr[0].ToString(); } dr[index] = the number of sequential columns in the sql statement so if u had select first, last, middle from table then it would be dr[0].ToString(), dr[1].ToString(), dr[2].ToString() or dr["first"].ToString(), dr["middle"].ToString(), dr["last"].ToString().
-
Hai Guffa, Thanks a lot for the response. But her I am not creating any command object. Using the written class i am executing sp like
SqlHelper.ExecuteReader(CustomConnString,DatabaseOwner & ObjectQualifier & sp_name,ouputpaaram)
I am using sqlDataReader to get the records. Then how I can proceed.? Where I can add the parameter and read value? If I get more clarification on this that will be really helpful.Thanks very much. Thank You, Rahul.P.Menon.