Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DataGridView Updated But Microsoft Access Database Not

$
0
0

Hi

Please Help

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;

namespace BUDBProject
{
    public partial class BUDBForm1 : Form
    {
        public BUDBForm1()
        {
            InitializeComponent();
        }
        //Load Form1
        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'bUDBACDataSet.BUDBT1' table. You can move, or remove it, as needed.
            this.bUDBT1TableAdapter.Fill(this.bUDBACDataSet.BUDBT1);
            //Disable InformationPanel On Load
            InformationPanel.Enabled = false;

        }
        //END Load Form1
        //Start NEW Buttom
        private void NewButt_Click(object sender, EventArgs e)
        {
            //Enable Pannel
            InformationPanel.Enabled = true;
            //Enter Data
            try
            {
                
                CompanyTB.Focus();
                this.bUDBACDataSet.BUDBT1.AddBUDBT1Row(this.bUDBACDataSet.BUDBT1.NewBUDBT1Row());
                bUDBT1BindingSource.MoveLast();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                bUDBT1BindingSource.ResetBindings(false);
            }

        }
        //END New Button
        //Start Edit Buttom
        private void EditButt_Click(object sender, EventArgs e)
        {
            InformationPanel.Enabled = true;
        }
        //End Edit Button
        //Start Save Button
        private void SaveButt_Click(object sender, EventArgs e)
        {
            //Disable Panel
            InformationPanel.Enabled = false;
            //Save Data
            try
            {
                this.Validate();
                this.bUDBT1BindingSource.EndEdit();
                this.bUDBACDataSet.AcceptChanges();
                this.bUDBT1TableAdapter.Update(this.bUDBACDataSet.BUDBT1);

                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                bUDBT1BindingSource.ResetBindings(false);
            }
        }
        //End Save Button
        //Start Cancel Button
        private void CancButt_Click(object sender, EventArgs e)
        {
            //Disable Panel
            InformationPanel.Enabled = false;
            bUDBT1BindingSource.ResetBindings(false);
        }
        //End Cancel Button
    }
}



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>