Usually when I execute a stored proc from C# (ASP.NET 3.5), I have to do the following:
myConnection.Open();
SqlCommand cmd = myConnection.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "myProc";
SqlParameter param1 = cmd.Parameters.Add("@param1", SqlDbType.VarChar);
param1.Direction = ParameterDirection.Input;
param1.Value = txtParam.Text;
SqlDataReader reader = cmd.ExecuteReader();
Is there a better way of doing this? Is there a way to create a C# class that is somewhat polymorphic that can handle calling a proc like you would a function? (ex. Procs.myProc(param1)
)