how to retrive data from stroed procedure in c#

Posted by rameshmandapelly-7781 under C# on 12/30/2010 | Points: 10 | Views : 1228 | Status : [Member] | Replies : 4
how to use stored procedure in c# like creat,insert data call data




Responses

Posted by: SheoNarayan on: 12/30/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hi Ramesh,

Read this article, that will guide you creating stored procedure and using them.
http://www.dotnetfunda.com/articles/article375-insert-data-using-parameters-through-stored-procedure-.aspx
These article has a sample source code contains the SP with database that should give you complete idea on how to do this
http://www.dotnetfunda.com/articles/article71.aspx
http://www.dotnetfunda.com/articles/article18.aspx

Thanks!

Regards,
Sheo Narayan
http://www.dotnetfunda.com

rameshmandapelly-7781, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Srinu.gandikota on: 12/31/2010 [Member] Starter | Points: 25

Up
0
Down
hi ramesh u can use stored procedures in c# as


SqlConnection conn = new SqlConnection("connectionString");
SqlCommand command = new SqlCommand("storedProcedurename", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("parametername1", SqlDbType.VarChar).Value =somevalue;
command.Parameters.Add("parametername2", SqlDbType.VarChar).Value = somevalue;
.
.
.
.
.

like this u can call stored procedure in c# and u can pass parameters to stored procedures
conn.Open();
int rows = command.ExecuteNonQuery();
conn.Close();

rameshmandapelly-7781, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suresh.mekkattil on: 1/9/2011 [Member] Bronze | Points: 25

Up
0
Down
HI,

You can use the CLR integration with the SQLServer.
Thus you can able to create StoreProcedure, Function, etc..

This enable you to write the storeprocedure with your C# code

-----
Suresh M

rameshmandapelly-7781, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/9/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Check this article it gives in and out of using the stored procedure in c#

http://www.c-sharpcorner.com/uploadfile/dclark/insoutsincs11302005072332am/insoutsincs.aspx

Thanks
Karthik
www.f5Debug.net

rameshmandapelly-7781, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response