You don't "code in C#" with stored procedures - stored procedures are a part of SQL server and allow you to save commonly used SQL commands so you can execute them very simply from your C# code.
To do that is easy. If you have an SP:
CREATE PROC [dbo].Sample
@Name varchar(100) OUTPUT
AS
BEGIN
SELECT @Name=Username FROM myTable WHERE iD=1
END
Then to use it from C#:
string r;
string s;
using (SqlConnection con = new SqlConnection(@"Data Source=GRIFFPC\SQLEXPRESS;Initial Catalog=myDatabase;Integrated Security=True"))
{
con.Open();
using (SqlCommand com = new SqlCommand("Sample", con))
{
com.CommandType = CommandType.StoredProcedure;
SqlParameter name = new SqlParameter("@Name", SqlDbType.VarChar, 100);
name.Direction = ParameterDirection.Output;
com.Parameters.Add(name);
com.ExecuteNonQuery();
r = (string) name.Value;
s = (string) com.Parameters["@Name"].Value;
}
}
Console.WriteLine("Name : {0}\nParam: {1}", r, s);