private void LoadTV(string dChoice) { try { string str = ""; SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand(); cmSQL.Connection = cnSQL; SqlDataReader drSQL; switch (dChoice) { case "State": str = "SELECT DISTINCT [State] AS dText FROM RegisterSchool"; break; case "Bank": str = "SELECT DISTINCT [BankName] AS dText FROM RegisterSchool"; break; case "Category": str = "SELECT DISTINCT [Category] AS dText FROM RegisterSchool"; break; case "Region": str = "SELECT DISTINCT [Region] AS dText FROM RegisterSchool"; break; } TV.Nodes.Clear(); cmSQL.CommandText = str; cmSQL.CommandType = CommandType.Text; cnSQL.Open(); drSQL = cmSQL.ExecuteReader(); TV.BeginUpdate(); TV.Nodes.Add("ALL", "ALL").ForeColor = Color.Red; while (drSQL.Read()) { if (Convert.IsDBNull(drSQL[0]) == false) { TV.Nodes.Add(drSQL[0].ToString(), drSQL[0].ToString()); } TV.EndUpdate(); } //cmSQL.Connection.Close() cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); cnSQL.Dispose(); return; } catch (Exception ex) { MessageBox.Show("Ooops! ERROR :" + char.ConvertFromUtf32(13) + ex, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void LoadXML(object path) { XmlDocument xDoc = new XmlDocument(); xDoc.Load((string)path); TV.BeginUpdate(); TV.Nodes.Clear(); TreeNode tn = new TreeNode(xDoc.DocumentElement.Name); AttType at = SaveNodeToTag(xDoc.DocumentElement); tn.Tag = at; TV.Nodes.Add(tn); addTreeNode(xDoc.DocumentElement, TV.Nodes[0]); TV.EndUpdate(); }
private void FrmSchoolListings_Load(object sender, EventArgs e) { dGrid.DataSource = BindingSource1; MyModules.applyGridTheme(dGrid); dGrid.ReadOnly = true; SplitContainer2.SplitterDistance = 322; cboCriteria.SelectedIndex = 1; TV.BeginUpdate(); TV.Nodes.Add("ALL", "ALL").ForeColor = Color.Red; TV.Nodes.Add("2016", "2016-Lot1"); TV.Nodes.Add("2017", "2016-Lot2"); TV.Nodes.Add("2018", "2016-Lot3"); TV.EndUpdate(); // LoadTV(); }
private void LoadTV() { try { SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand("SELECT DISTINCT [State] FROM Register", cnSQL); SqlDataReader drSQL; TV.Nodes.Clear(); cmSQL.CommandType = CommandType.Text; cnSQL.Open(); drSQL = cmSQL.ExecuteReader(); TV.BeginUpdate(); TV.Nodes.Add("ALL", "ALL").ForeColor = Color.Red; while (drSQL.Read()) { if (Convert.IsDBNull(drSQL[0]) == false) { TV.Nodes.Add(drSQL[0].ToString(), drSQL[0].ToString()); } TV.EndUpdate(); } //cmSQL.Connection.Close() cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); cnSQL.Dispose(); return; } catch (Exception ex) { MessageBox.Show("Ooops! ERROR :" + char.ConvertFromUtf32(13) + ex, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void LoadTV(string dChoice) { try { string str = ""; SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand(); cmSQL.Connection = cnSQL; SqlDataReader drSQL; switch (dChoice) { case "State of Origin": str = "SELECT DISTINCT [State] AS dText FROM RegisterStudent"; break; case "Bank": str = "SELECT DISTINCT [BankName] AS dText FROM RegisterStudent"; break; case "Degree": str = "SELECT DISTINCT [Degree] AS dText FROM RegisterStudent"; break; case "EndYear": str = "SELECT DISTINCT [EndYear] AS dText FROM RegisterStudent"; break; case "School": // str = "SELECT DISTINCT Cast([SchoolID] AS nvarchar(50)) + ' - ' + [SchName] AS dText FROM RegisterStudent LEFT OUTER JOIN RegisterSchool ON RegisterStudent.SchoolID = RegisterSchool.Sn"; str = "SELECT DISTINCT Cast([SchoolID] AS nvarchar(50)) + ' - ' + [SchName] AS dText,[SchName] FROM RegisterStudent ORDER BY SchName"; break; case "Category": str = "SELECT DISTINCT [Category] AS dText FROM RegisterStudent"; break; case "Region": str = "SELECT DISTINCT [Region] AS dText FROM RegisterStudent"; break; } TV.Nodes.Clear(); cmSQL.CommandText = str; cmSQL.CommandType = CommandType.Text; cnSQL.Open(); drSQL = cmSQL.ExecuteReader(); TV.BeginUpdate(); TV.Nodes.Add("ALL", "ALL").ForeColor = Color.Red; while (drSQL.Read()) { if (Convert.IsDBNull(drSQL[0]) == false) { TV.Nodes.Add(drSQL[0].ToString(), drSQL[0].ToString()); } TV.EndUpdate(); } //cmSQL.Connection.Close() cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); cnSQL.Dispose(); return; } catch (Exception ex) { MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void LoadTV(string dChoice) { try { string str = ""; SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand(); cmSQL.Connection = cnSQL; SqlDataReader drSQL; string theCond = ""; if (Source1 == "STAFF") { theCond = " WHERE Source='STAFF'"; } else { theCond = " WHERE Source='VENDOR'"; } switch (dChoice) { case "Bank": str = "SELECT DISTINCT [BankName] AS dText FROM RegisterVendor" + theCond; break; case "Category": str = "SELECT DISTINCT [Category] AS dText FROM RegisterVendor" + theCond; break; case "Region": str = "SELECT DISTINCT [Region] AS dText FROM RegisterVendor" + theCond; break; } TV.Nodes.Clear(); cmSQL.CommandText = str; cmSQL.CommandType = CommandType.Text; cnSQL.Open(); drSQL = cmSQL.ExecuteReader(); TV.BeginUpdate(); TV.Nodes.Add("ALL", "ALL").ForeColor = Color.Red; while (drSQL.Read()) { if (Convert.IsDBNull(drSQL[0]) == false) { TV.Nodes.Add(drSQL[0].ToString(), drSQL[0].ToString()); } TV.EndUpdate(); } //cmSQL.Connection.Close() cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); cnSQL.Dispose(); return; } catch (Exception ex) { MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }