views:

22

answers:

0

Steps,

  1. Crate window application with single form
  2. add new datasource from Data->Add new Data source
  3. Goto Data->Show Data Source
  4. Drop any table to form. This step will add tow controls. a. DataGridView b. Binding Navigator

press F5 to run.

I am able to view all the records but not able to do add/update/delete.

Below is the code of the form that is generated by VS.

namespace TestingGrid
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void testBindingNavigatorSaveItem_Click( object sender, EventArgs e )
        {
            this.Validate();
            this.testBindingSource.EndEdit();
            this.testTableAdapter.Update( this.testDataSet.Test );

        }

        private void Form1_Load( object sender, EventArgs e )
        {
            // TODO: This line of code loads data into the 'testDataSet.Test' table. You can move, or remove it, as needed.
            this.testTableAdapter.Fill( this.testDataSet.Test );

        }
    }
}