Ejemplo n.º 1
0
 private void Save()
 {
     try
     {
         prod_orderTableAdapter daOrder = new prod_orderTableAdapter();
         daOrder.Update(dsOrder.prod_order); // Call update method on the service adapter so it updates the table in memory ( All changes made are applied - CRUD)
         dsOrder.AcceptChanges();            // Call accept method on the dataset so it update the chanmges to the database
         lblStatus.Text = "Record Successfully Updated";
     }
     catch
     {
         dsOrder.RejectChanges();
         lblStatus.Text = "Unable to Update Record";
     }
 }
Ejemplo n.º 2
0
        private void Save()
        {
            on_orderTableAdapter daOrder = new on_orderTableAdapter();

            try
            {
                daOrder.Update(dsOrder.on_order);
                dsOrder.AcceptChanges();
                this.lblStatus.Text = "Order Created";
                Clear();
            }
            catch
            {
                dsOrder.RejectChanges();
                this.lblStatus.Text = "Failed";
            }
        }
Ejemplo n.º 3
0
        protected void btnDeleteConfirm_Click(object sender, EventArgs e)
        {
            if (id != -1)
            {
                try
                {
                    DataRow record = dsOrder.on_order.FindByid(id);            // Find and add the record to tbe record variable
                    record.Delete();                                           // Deletes the record in memory

                    on_orderTableAdapter daOrder = new on_orderTableAdapter(); // table adapter to service table (Service adapter)
                    daOrder.Update(record);                                    // Call update method on the service adapter so it updates the table in memory ( All changes made are applied - CRUD)
                    dsOrder.AcceptChanges();                                   // Call accept method on the dataset so it update the chanmges to the database
                                                                               //Refresh the page to show the record being deleted
                    Response.Redirect("ArrivedOrderDefaultPage.aspx");
                }
                catch
                {
                    lblStatus.Text = "Delete failed.";
                }
            }
        }