Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Updating data in data set and data table.

Updating data in data set and data table.

Scheduled Pinned Locked Moved C#
cssdatabasesalestutorialannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Omar Akhtar Sheikh
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • O Omar Akhtar Sheikh

      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

      N Offline
      N Offline
      nelsonpaixao
      wrote on last edited by
      #2

      "...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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups