Updating data in data set and data table.
-
I am using a data grid view which loads data from the database and displays. Moreover, on my form are the buttons as INSERT(i.e for inserting records in database and grid), DELETE_SELECTED_ROWS(i.e for deleting records from database and grid). Now as you know that grids are editable so if any changes are made inside the grid then how to update. Talking all in all I need to know how to update a dataset/datatable <pre> <code> private void ManageCustomer_Load(object sender, EventArgs e) { LoadCustomers(); } private void btnInsertInDataBase_Click(object sender, EventArgs e) { // Insert Customer In Database DALHelper helper = new DALHelper(); helper.InsertCustomer(textBox1.Text); LoadCustomers(); } private void LoadCustomers() { // Load Cashiers from Database DALHelper dal = new DALHelper(); dataGridView1.DataSource = dal.GetCustomers(); dataGridView1.Refresh(); } List<int>customerIDsToDelete = new List<int>(); private void btnDELETE_Click(object sender, EventArgs e) { // Iterate al
-
I am using a data grid view which loads data from the database and displays. Moreover, on my form are the buttons as INSERT(i.e for inserting records in database and grid), DELETE_SELECTED_ROWS(i.e for deleting records from database and grid). Now as you know that grids are editable so if any changes are made inside the grid then how to update. Talking all in all I need to know how to update a dataset/datatable <pre> <code> private void ManageCustomer_Load(object sender, EventArgs e) { LoadCustomers(); } private void btnInsertInDataBase_Click(object sender, EventArgs e) { // Insert Customer In Database DALHelper helper = new DALHelper(); helper.InsertCustomer(textBox1.Text); LoadCustomers(); } private void LoadCustomers() { // Load Cashiers from Database DALHelper dal = new DALHelper(); dataGridView1.DataSource = dal.GetCustomers(); dataGridView1.Refresh(); } List<int>customerIDsToDelete = new List<int>(); private void btnDELETE_Click(object sender, EventArgs e) { // Iterate al
"...Now as you know that grids are editable so if any changes are made inside the grid then how to update..." sorry i didn´t check your code because of this sentence you don´t edit that DataGridView, you edit the database in sql database, you create Store Procedures that you trigger in an c# event like button click the SP you create are: insert row, update row, delete row etc etc etc so, to make changes in the DB you have to trigger the procedure you want, after, show it in the DGV (later, don´t forget to use crystal report to display and print data)
nelsonpaixao@yahoo.com.br trying to help & get help