I have a stored procedure that returns a list, but how can I put the result into a list in C#?
using(SqlConnection sqlConnectionString = new SqlConnection(ConfigurationManager.ConnectionStrings["EfenKaConnectionString"].ConnectionString))
using(SqlCommand cmd = new SqlCommand("SP_ListMonths", sqlConnectionString))
{
SqlDataReader reader;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@MONTH", SqlDbType.Int).Direction = ParameterDirection.Output;
sqlConnectionString.Open();
cmd.ExecuteNonQuery();
int defualtMonth = Convert.ToInt32(cmd.Parameters["@MONTH"].Value);
reader = cmd.ExecuteReader();
sqlConnectionString.Close();
}
How can I acces the values from reader?