.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

How to get output value from stored procedure?

Posted By: priya     Posted Date: February 22, 2010    Points:2   Category :Sql Server
Hi,

How to get the output parameter value returned by stored procedure in asp.net?

I am using C# as my code language

Thanks
Priya

Responses
Author: Lalij Mer             
Posted Date: February 22, 2010     Points: 5   
Author: jay             
Posted Date: February 23, 2010     Points: 5   

think that ur sp returns a single value username


sqlcommand cmd=new sqlcommand("sp_name",con);
cmd.commamdtype=commandtype.storedprocedure();

object obj=cmd.ExecuteScalar();
string str=COnvert.Tostring(obj);


now the output of sp is available in string "str"

same use SqlDataAdapter if ur sp returns a table.

Author: Prasanti Prusty             
Posted Date: February 24, 2010     Points: 5   

Hi Priya,

Just check the link you can get Idea

http://www.dotnetspark.com/kb/1550-get-output-paramete-value-from-sp-using.aspx

Regards,
Chikul

Regards,
Prasanti
Author: Sagar Pardeshi             
Posted Date: February 25, 2010     Points: 5   

//

sqlconnection sqlconn=new sqlconnection("connectionstring");

SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlconn;
cmd.CommandText = "exec proc_insertuserprofilecur '" + ImportpId + "'";
cmd.ExecuteNonQuery();



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend