private void lbSp_SelectedIndexChanged(object sender, EventArgs e) { ListBox myLb = (ListBox)lblSp; if (myLb.Text != "System.Data.DataRowView") { Works.RunIfDbExists(GetSPContents, cbDatabases.Text.Trim()); } }
private void cbDatabases_SelectedIndexChanged(object sender, EventArgs e) { ComboBox mycb = (ComboBox)sender; if (!string.IsNullOrEmpty(mycb.Text) && mycb.Text != "System.Data.DataRowView") { Works.RunIfDbExists(GetSPList, cbDatabases.Text.Trim()); } }
private void lstTables_SelectedIndexChanged(object sender, EventArgs e) { if (!lblSearch.Text.Contains("(")) { lblSearch.Text += " ( in " + DbName + " )"; } ListBox myLb = (ListBox)lstTables; if (myLb.Text != "System.Data.DataRowView") { Works.RunIfDbExists(GetColumnsByTable, DbName); } }
private void txtCriteria_TextChanged(object sender, EventArgs e) { if (chkColumns.Checked) { lstTables.Items.Clear(); Works.RunIfDbExists(delegate() { SqlDataAdapter da = new SqlDataAdapter( string.Format(@"USE {0}; SELECT c.name +' ('+t.name+')' ad FROM sys.tables AS t INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID WHERE c.name LIKE '%{1}';", DbName, GetMyFilter()), Settings.Default.cnnStr); DataTable dtTables = new DataTable(); da.Fill(dtTables); lstColumns.DataSource = dtTables; lstColumns.DisplayMember = "ad"; lstColumns.ValueMember = "ad"; label1.Text = string.Format("Columns ({0})", lstColumns.Items.Count); }, DbName); } else { Works.RunIfDbExists(delegate() { SqlDataAdapter da = new SqlDataAdapter( string.Format(@"USE {0}; SELECT name ad FROM sys.objects WHERE type = 'U' and name like '%{1}';", DbName, GetMyFilter()), Settings.Default.cnnStr); DataTable dtTables = new DataTable(); da.Fill(dtTables); lstTables.DataSource = dtTables; lstTables.DisplayMember = "ad"; lstTables.ValueMember = "ad"; lblSpName.Text = string.Format("Tables ({0})", lstTables.Items.Count); }, DbName); } }
private void txtCriteria_TextChanged(object sender, EventArgs e) { Works.RunIfDbExists(delegate() { SqlDataAdapter da = new SqlDataAdapter( string.Format(@"USE {0}; SELECT DISTINCT OBJECT_NAME(id) as ad,id FROM syscomments WHERE OBJECTPROPERTY(id, 'IsProcedure') = 1 AND (OBJECT_NAME(id) LIKE '%{1}' OR [text] LIKE '%{1}');", cbDatabases.Text.Trim(), GetMyFilter()), Settings.Default.cnnStr); DataTable dtProcedures = new DataTable(); da.Fill(dtProcedures); lblSp.DataSource = dtProcedures; lblSp.DisplayMember = "ad"; lblSp.ValueMember = "id"; lblSpName.Text = string.Format("Stored Procedures ({0})", lblSp.Items.Count); }, cbDatabases.Text.Trim()); }