using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Data.Sql; using System.Data.SqlClient; namespace WpfApplication19 { /// /// Interaction logic for ChooseRecord.xaml /// public partial class ChooseRecord : Window { private SqlConnection _proConn; public ChooseRecord(string lotNo) { InitializeComponent(); this.LotNo = lotNo; try { _proConn = Utils.createSqlConnection("productionDbCS"); } catch (SqlException se) { MessageBox.Show("productionDbCS : ", se.Message); } SetupObject(); //LotNoLabel.Content = LotNo; } private void SetupObject() { SqlDataReader reader = Utils.Query(_proConn, "select updated_at from data where lot_no = '"+this.LotNo+"' group by updated_at"); while (reader.Read()) { DateTimeCB.Items.Add(new ComboBoxItem() { Tag = "a", Content = reader["updated_at"].ToString() }); } reader.Close(); //DateTimeCB.ItemsSource = } public string LotNo { get; set; } private void PreviewBtn_Click(object sender, RoutedEventArgs e) { Application.Current.MainWindow.Show(); var w = (MainWindow)Application.Current.MainWindow; var s = ((ComboBoxItem)DateTimeCB.SelectedItem).Content.ToString(); w.setFilterLogData(((ComboBoxItem)DateTimeCB.SelectedItem).Content.ToString()); Close(); } } }