예제 #1
0
 private void searchTB_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(searchTB.Text) && table != "Data" && column != null)
     {
         string query;
         if (column != "ID")
         {
             query = "Select * from " + table + " Where " + column + " like N'%" + searchTB.Text + "%'";
         }
         else
         {
             query = "Select * from " + table + " Where " + column + " = " + searchTB.Text + " ";
         }
         DataBaseTools.open();
         SqlCommand cmd = new SqlCommand(query, DataBaseTools.conn);
         cmd.ExecuteNonQuery();
         SqlDataAdapter a = new SqlDataAdapter(cmd);
         DataTable      t = new DataTable();
         a.Fill(t);
         searchGrid.ItemsSource = t;
         DataBaseTools.close();
         matchesTB.Text = searchGrid.VisibleRowCount + "";
     }
     else
     {
         matchesTB.Text         = "";
         searchGrid.ItemsSource = null;
         searchGrid.Columns.Clear();
     }
 }
예제 #2
0
 private void ExecuteCommand(SqlCommand cmd)
 {
     cmd.ExecuteNonQuery();
     Dispatcher.Invoke(new Action(() =>
     {
         SqlDataAdapter a = new SqlDataAdapter(cmd);
         DataTable t      = new DataTable();
         a.Fill(t);
         searchGrid.ItemsSource = t;
         searchGrid.GroupBy("Title");
         searchGrid.GroupBy("Page Number");
         Dispatcher.Invoke(new Action(() => {
             searchGrid.FindRowByValue("Text", searchTB.Text);
         }));
         DataBaseTools.close();
         matchesTB.Text          = searchGrid.VisibleRowCount + "";
         progressbar1.Visibility = System.Windows.Visibility.Hidden;
     }));
 }