private void bt_query_Click(object sender, RoutedEventArgs e) { SqlHelper sqlHelper = new SqlHelper(); string sql = ""; switch (this.comb_title.SelectedIndex) { case 0: sql = "select * from MCA_Pool order by UpdateDateTime desc"; break; case 1: sql = "select * from MCA_Pool where SampleComment like '%" + this.textbox_content.Text + "%' order by UpdateDateTime desc"; break; case 2: sql = "select * from MCA_Pool where UpdateDateTime like '%" + this.textbox_content.Text + "%' order by UpdateDateTime desc"; break; } sqlHelper.getSomeDate(sql); if (sqlHelper.dt.DefaultView.Count > 0) { obc_qvm = ModelConvertHelper <QueryDataViewModel> .ConvertToObc(sqlHelper.dt); DG1.ItemsSource = obc_qvm; } else { obc_qvm = new ObservableCollection <QueryDataViewModel>(); } DG1.ItemsSource = obc_qvm; }
private void bt_query_Click(object sender, RoutedEventArgs e) { SqlHelper sqlHelper = new SqlHelper(); string sql = ""; switch (this.comb_title.SelectedIndex) { case 0: sql = "select distinct FileName, ImportDateTime from MCA_ACE_TYPE2_DATA order by ImportDateTime desc"; break; case 1: sql = "select distinct FileName, ImportDateTime from MCA_ACE_TYPE2_DATA where FileName like '%" + this.textbox_content.Text + "%' order by ImportDateTime desc"; break; case 2: sql = "select distinct FileName, ImportDateTime from MCA_ACE_TYPE2_DATA where ImportDateTime like '%" + this.textbox_content.Text + "%' order by ImportDateTime desc"; break; } sqlHelper.getSomeDate(sql); if (sqlHelper.dt.DefaultView.Count > 0) { obc_qvm = ModelConvertHelper <QueryDataViewModelType2> .ConvertToObc(sqlHelper.dt); DG1.ItemsSource = obc_qvm; } else { obc_qvm = new ObservableCollection <QueryDataViewModelType2>(); } DG1.ItemsSource = obc_qvm; }