Browser.mod.DB.LoadProject C# (CSharp) Method

LoadProject() public static method

public static LoadProject ( sProject>.Dictionary &projectList ) : bool
projectList sProject>.Dictionary
return bool
        public static bool LoadProject(out Dictionary<int, sProject> projectList)
        {
            projectList = new Dictionary<int, sProject>();

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                try
                {
                    conn.Open();

                    SqlCommand cmd1 = new SqlCommand("usp_select_project_all", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;

                    SqlDataReader reader = cmd1.ExecuteReader();

                    while (reader.Read())
                    {
                        sProject projectItem;

                        projectItem.uid = reader.GetInt32(0);
                        projectItem.name = reader.GetString(1);

                        projectList.Add(projectItem.uid, projectItem);
                    }

                    reader.Close();
                }
                catch (System.Exception)
                {
                    return false;
                }
            }

            return true;
        }