diff --git a/trayToDB/MainWindow.Designer.cs b/trayToDB/MainWindow.Designer.cs index 0545798..d46dc5e 100644 --- a/trayToDB/MainWindow.Designer.cs +++ b/trayToDB/MainWindow.Designer.cs @@ -86,11 +86,11 @@ this.dateTimePicker1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.dateTimePicker1.Checked = false; this.dateTimePicker1.Location = new System.Drawing.Point(156, 78); this.dateTimePicker1.Name = "dateTimePicker1"; this.dateTimePicker1.Size = new System.Drawing.Size(350, 26); this.dateTimePicker1.TabIndex = 4; - this.dateTimePicker1.Value = new System.DateTime(2019, 3, 15, 0, 0, 0, 0); // // browseButton // diff --git a/trayToDB/MainWindow.cs b/trayToDB/MainWindow.cs index 459a28a..c8deb57 100644 --- a/trayToDB/MainWindow.cs +++ b/trayToDB/MainWindow.cs @@ -36,12 +36,6 @@ namespace trayToDB private List listOfData; private DateTime shippingDate; - private static string server = "localhost"; - private static string user = "sipm"; - private static string database = "sipmtest"; - private static string port = "3306"; - //private static string password = ""; - public MainWindow() { InitializeComponent(); @@ -51,7 +45,7 @@ namespace trayToDB openFileDialog1.Filter = "Excel sheets (*.xls;*.xlsx)|*.xls;*.xlsx"; openFileDialog1.Multiselect = false; openFileDialog1.CheckFileExists = true; - + dateTimePicker1.MaxDate = DateTime.Today; } private void Form1_Load(object sender, EventArgs e) @@ -183,7 +177,7 @@ namespace trayToDB MySqlConnection conn = new MySqlConnection(connStr); try { - statusTextbox.AppendText("Connecting to " + user + "@" + server + ":" + port + "\n"); + statusTextbox.AppendText("Connecting to " + Properties.Settings.Default.user + "@" + Properties.Settings.Default.server + ":" + Properties.Settings.Default.port + "\n"); conn.Open(); statusTextbox.AppendText("Successfully connected\n"); // Perform database operations @@ -258,7 +252,8 @@ namespace trayToDB for (int j = 0; j < listOfData[i].noOfSipm; j++) { cmd.Parameters.Clear(); - cmd.CommandText = "INSERT INTO sipmtable (hamamatsutrayid, hamamatsutrayposition, outputtrayid, outputtrayposition) VALUES (@trayid ,@j , 1, 1)"; + //cmd.CommandText = "INSERT INTO sipmtable (hamamatsutrayid, hamamatsutrayposition, outputtrayid, outputtrayposition) VALUES (@trayid ,@j , 1, 1)"; + cmd.CommandText = "INSERT INTO sipmtable (hamamatsutrayid, hamamatsutrayposition) VALUES (@trayid ,@j)"; cmd.Parameters.AddWithValue("@shipping", shippingDate); cmd.Parameters.AddWithValue("@trayid", trayid); cmd.Parameters.AddWithValue("@trayno", listOfData[i].trayNo);