private void scanpacking(String packing) { lblMessage.Text = ""; lblMessage.Text = packing; packing = packing.Replace("\n", String.Empty).Replace("\t", String.Empty).Replace("\r", String.Empty); //lblMessage.Text = packing; List <object[]> data = new List <object[]>(); MainMenu frm = new MainMenu(); //Get Box No String boxno = ""; data = frm.get_data_table_string_fieldname("tbpacking", "box_number", "case_number", packing); if (data.Count > 0) { boxno = data[0][0].ToString(); } //Check Shipping Number data = frm.get_data_table_string_fieldname("tbpacking", "shipping_unit_number", "case_number", packing); if (data.Count > 0) { String shipno = data[0][0].ToString(); if (!shipno.Equals("")) { lblMessage.Text = "Case No " + packing + " has been loaded to " + shipno + ". Please scan another case_number"; return; } else { String batchno = frm.get_batch_number(boxno); String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); try { MySqlCommand mySql3 = conn5.CreateCommand(); mySql3.CommandText = "update tbpacking set shipping_unit_number=@shipping_unit_number, remark=@remark, batchcode=@batchcode,moddatetime=@moddatetime where case_number=@case_number"; mySql3.Parameters.AddWithValue("@shipping_unit_number", lblpackinglist.Text.Trim()); mySql3.Parameters.AddWithValue("@case_number", packing); mySql3.Parameters.AddWithValue("@batchcode", batchno); mySql3.Parameters.AddWithValue("@remark", txtremark.Text.Trim()); DateTime dt = DateTime.Now; String cdate = dt.ToString("yyyy-MM-dd HH:mm:ss"); DateTime currdate = DateTime.Parse(cdate); mySql3.Parameters.AddWithValue("@moddatetime", frm.get_server_time()); mySql3.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } conn5.Close(); } } else { lblMessage.Text = "Case No " + packing + " is not available. Please scan another case_number"; return; } }