Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public bool InsertProcessToAS400(iDB2Connection cn, Order order)
  2. {
  3. bool result = false;
  4. try
  5. {
  6.  
  7. var code = GetCodeOfDdtConnected(cn, processCode, order.Code);
  8. iDB2Command cmd = cn.CreateCommand();
  9.  
  10. cmd.CommandText =$"INSERT INTO PCM00F " +
  11. $"(Code)" +
  12. $"VALUES(@P1)";
  13.  
  14. var p = new iDB2Parameter("@P1", iDB2DbType.iDB2VarChar);
  15. p.Value = code; cmd.Parameters.Add(p);
  16.  
  17. cmd.ExecuteNonQuery(); // <- This close the service
  18.  
  19. result = true;
  20. }
  21. catch (Exception ex)
  22. {
  23. log.Error("An error occurred while Synchronizer (INSERT): ", ex);
  24. result = false;
  25. }
  26. finally
  27. {
  28. cmd.Dispose(); cmd = null;
  29. }
  30.  
  31. return result;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement