Guest User

Untitled

a guest
Jan 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. private void ProcessRecord(string optionCode, string iso, string partNumber, string skuCode, string serial, string upc, string date, string description, string country, string machine)
  2. {
  3. OleDbConnection con = new OleDbConnection(ConnectionString);
  4.  
  5. try
  6. {
  7. con.Open();
  8. OleDbCommand cmd = new OleDbCommand("", con);
  9.  
  10. string sqlCopy = @"INSERT INTO Archive ( PartNumber, SerialNumber, UPC, [Option], Product, Description, Country, PrintDate, Machine )
  11. SELECT PartNumber, SerialNumber, UPC, [Option], Product, Description, Country, PrintDate , Machine FROM [Output];";
  12. string sqlDelete = @"delete from [Output];";
  13. string sqlOutPut = @"INSERT INTO [Output] ( PartNumber, SerialNumber, UPC, [Option], Product, Description, Country, PrintDate, Machine )
  14. values ( '" + partNumber + "', '" + serial + "', '" + upc + "', '" + optionCode + "', '" + skuCode + "', '" + description + "', '" + country + "', '" + date + "', '" + machine+ "');";
  15.  
  16. cmd.CommandText = sqlCopy;
  17. int countCopy = cmd.ExecuteNonQuery();
  18.  
  19. cmd.CommandText = sqlDelete;
  20. int countDelete = cmd.ExecuteNonQuery();
  21.  
  22. cmd.CommandText = sqlOutPut;
  23. int countInsert = cmd.ExecuteNonQuery();
  24.  
  25. while (backgroundWorker1.IsBusy)
  26. {
  27. System.Threading.Thread.Sleep(100);
  28. }
  29.  
  30. backgroundWorker1.RunWorkerAsync();
  31. }
  32. catch
  33. {
  34.  
  35. }
  36. finally
  37. {
  38. con.Close();
  39. }
  40. }
Add Comment
Please, Sign In to add comment