Send MS SQL Server 2005 stored procedure a variable from within a C# application

Send MS SQL Server 2005 stored procedure a variable from within a C# application

Post by rhaaz » Sun, 12 Aug 2007 05:43:07



How do I send a stored procedure a variable collected from an
application in C#.
What C# code is necessary, and how do I declare and assign the value
in my sproc?
 
 
 

Send MS SQL Server 2005 stored procedure a variable from within a C# application

Post by Sammy Li » Sun, 12 Aug 2007 07:42:04


If your stored proc takes parameters, you can use the
SqlCommand.Parameters collection to pass in parameters to the stored
proc.
code:
SqlCommand cmd = new SqlCommand();


There are alot of articles on C# and stored procedures, try googling.


Quote:> How do I send a stored procedure a variable collected from an
> application in C#.
> What C# code is necessary, and how do I declare and assign the value
> in my sproc?