private void GetSops() { _sopsList.Clear(); ddlSop.DataSource = null; try { var query = (from ls in _context.usp_QT_LightingStudy_GetSOPs(Application, Program, LedHarness).ToList() select ls); if (!query.Any()) { return; } _sopsList.Add(""); foreach (var item in query) { _sopsList.Add(item.SOP); } ddlSop.DataSource = _sopsList; } catch (Exception ex) { string error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; MessageBox.Show(string.Format("Failed to return Lighting SOPs. Try refreshing. {0}", error), "Error at GetSops()"); } }