public Form1() { InitializeComponent(); // Initialize form components dataBase = new MySQLConnection(); // Create database connection fillStates(); // Fill state drop box // Populate Categories Lists string qStr = "SELECT name FROM Categories"; List <string> qResults = new List <string>(); // Query must return list, even if we know there will only be one item qResults = dataBase.SQLSELECTExec(qStr, "name"); qResults.Sort(); // Sort query list qResults = qResults.Distinct().ToList(); foreach (string item in qResults) { listBoxCategoryDem.Items.Add(item); listBoxCategorySearch.Items.Add(item); } // Populate Attributes List qStr = "SELECT DISTINCT name FROM Attributes"; qResults = dataBase.SQLSELECTExec(qStr, "name"); qResults.Sort(); listBoxAttributes.Items.AddRange(qResults.ToArray()); }
public Form1() { InitializeComponent(); // Initialize form components dataBase = new MySQLConnection(); // Create database connection fillStates(); // Fill state drop box // Populate Categories Lists string qStr = "SELECT name FROM Categories"; List<string> qResults = new List<string>(); // Query must return list, even if we know there will only be one item qResults = dataBase.SQLSELECTExec(qStr, "name"); qResults.Sort(); // Sort query list qResults = qResults.Distinct().ToList(); foreach(string item in qResults) { listBoxCategoryDem.Items.Add(item); listBoxCategorySearch.Items.Add(item); } // Populate Attributes List qStr = "SELECT DISTINCT name FROM Attributes"; qResults = dataBase.SQLSELECTExec(qStr, "name"); qResults.Sort(); listBoxAttributes.Items.AddRange(qResults.ToArray()); }
private void boxState_SelectionChangeCommitted(object sender, EventArgs e) { // First clear all the demographic info clearStateSummary(); clearCitySummary(); clearZipSummary(); // Clear the left side boxes listBoxCityDem.Items.Clear(); listBoxZipDem.Items.Clear(); // City Query, will populate city box string qStr = "SELECT distinct city FROM Demographics WHERE state='" + boxStateDem.SelectedItem.ToString() + "' ORDER BY city;"; List <string> qResults = dataBase.SQLSELECTExec(qStr, "city"); foreach (string result in qResults) { listBoxCityDem.Items.Add(result); } // Zip Query for whole state, will be refined later qStr = "SELECT zipcode FROM Demographics WHERE state='" + boxStateDem.SelectedItem.ToString() + "' ORDER BY zipcode;"; qResults = dataBase.SQLSELECTExec(qStr, "zipcode"); foreach (string result in qResults) { listBoxZipDem.Items.Add(result); } // Update State Summary updateStateSummary(); // Update State Results Box textBoxState.Text = boxStateDem.SelectedItem.ToString(); // Update Business Search if any categories were already selected if (listBoxSelectedCategoriesDem.Items.Count > 0) { businessSearch(); } }
private void boxState_SelectionChangeCommitted(object sender, EventArgs e) { // First clear all the demographic info textBoxPop.Clear(); textBoxIncome.Clear(); textBox18.Clear(); textBox24.Clear(); textBox44.Clear(); textBox64.Clear(); textBox65.Clear(); textBoxAge.Clear(); // Clear the left side boxes listBoxCity.Items.Clear(); listBoxZip.Items.Clear(); // City Query, will populate city box string qStr = "SELECT distinct city FROM CensusData WHERE state='" + boxState.SelectedItem.ToString() + "' ORDER BY city;"; List <string> qResults = dataBase.SQLSELECTExec(qStr, "city"); foreach (string result in qResults) { listBoxCity.Items.Add(result); } // Zip Query for whole state, will be refined later qStr = "SELECT zipcode FROM CensusData WHERE state='" + boxState.SelectedItem.ToString() + "' ORDER BY zipcode;"; qResults = dataBase.SQLSELECTExec(qStr, "zipcode"); foreach (string result in qResults) { listBoxZip.Items.Add(result); } }