private void GetLedHarness() { _ledHarnessList.Clear(); ddlLedHarness.DataSource = null; try { var query = (from ls in _context.usp_QT_LightingStudy_GetLEDHarness(Application, Program).ToList() select ls); if (!query.Any()) { return; } _ledHarnessList.Add(""); foreach (var item in query) { _ledHarnessList.Add(item.LED_Harness); } ddlLedHarness.DataSource = _ledHarnessList; } catch (Exception ex) { string error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; MessageBox.Show(string.Format("Failed to return LED/Harness data. Try refreshing. {0}", error), "Error at GetLedHarness()"); } }