SHARE
TWEET

Untitled

a guest Mar 24th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  private Exception UpdateOrderSheetTable(DataGridView dataGridView, string type)
  2.         {
  3.             try
  4.             {
  5.                 DataTable dt = new DataTable();
  6.                 dt = (DataTable)dataGridView.DataSource;
  7.                 string text = orderSheetHandler.GetOrderSheets(type);
  8.                 string text2 = orderSheetHandler.GetUpdateCommand(type);
  9.  
  10.                 SqlControl.OpenConnection(text);
  11.                 SqlControl.SqlDataAdapter.UpdateCommand = new MySqlCommand(text2);
  12.                 SqlControl.SqlDataAdapter.UpdateCommand.Connection = SqlControl.Connection;
  13.                 SqlControl.SqlDataAdapter.DeleteCommand =
  14.                     new MySqlCommand(String.Format(@"delete from {0}order_sheets where order_sheets_id = @order_sheets_id", type), SqlControl.Connection);
  15.                 SqlControl.SqlDataAdapter.DeleteCommand.Parameters.Add("order_sheets_id", MySqlDbType.Int16, 0, "order_sheets_id").SourceVersion = DataRowVersion.Original;
  16.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("upc_number", MySqlDbType.VarChar, 13, "upc_number");
  17.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("catalog_number", MySqlDbType.VarChar, 15, "catalog_number");
  18.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("label_studio_name", MySqlDbType.VarChar, 35, "label_studio_name");
  19.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("artist_name", MySqlDbType.VarChar, 30, "artist_name");
  20.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("item_title", MySqlDbType.VarChar, 50, "item_title");
  21.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("vendor_number", MySqlDbType.VarChar, 6, "vendor_number");
  22.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("month_code", MySqlDbType.VarChar, 6, "month_code");
  23.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("year_code", MySqlDbType.VarChar, 6, "year_code");
  24.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("price", MySqlDbType.VarChar, 6, "price");
  25.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("reorder_number", MySqlDbType.VarChar, 6, "reorder_number");
  26.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("qty", MySqlDbType.Int16, 0, "qty");
  27.                 SqlControl.SqlDataAdapter.UpdateCommand.Parameters.Add("order_sheets_id", MySqlDbType.Int16, 0, "order_sheets_id");
  28.                 SqlControl.SqlDataAdapter.Update(dt);
  29.                 SqlControl.SqlDataAdapter.Dispose();
  30.                 log.Info(String.Format("[UpdateOrderSheetTable] type: {0} update successful", type));
  31.             }
  32.             catch (Exception ex)
  33.             {
  34.                 log.Error(String.Format("[UpdateOrderSheetTable] type: {0} update failed.\r\n{1}", type, ex.Message));
  35.                 return ex;
  36.             }
  37.             return null;
  38.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top