locked
Save Data from DataGridView to DataBase RRS feed

  • Question

  • Hi everyone !

    I'm working on an exercise in VB.net which is about the SAVE button, 

    so I have a datagridview loaded with data, 

    My problem so far is that after deleting rows, inserting new rows or even editing some rows, I have to click on the SAVE button to send the modifications to database !!

    Any help to do the SAVE button?

    Wednesday, January 2, 2013 2:23 PM

Answers

  • Hello,

    There are many methods to read/write data, at the lowest level there is always SQL but above this determines steps used to execute the SQL. I would start here MSDN Walkthrough: Saving Data to a Database (Single Table) which is one of the methods to work with data. If this is not helpful then run thru the following page for similar articles where you may have to drill down to find this information.

    FYI: Unless you write code to immediately save database operations they will not happen. You could watch for changes to a DataTable which is the container for your data via DataTable events as demo'd in the following article. The method to create events can vary i.e. as shown in the article or if strongly typed in the xsd file Visual Studio generated for you. Lastly there are some videos here.


    KSG


    • Edited by KareninstructorMVP Wednesday, January 2, 2013 4:17 PM Added information on DataTable events
    • Proposed as answer by Frank L. Smith Thursday, January 3, 2013 1:27 AM
    • Marked as answer by Youen Zen Thursday, January 10, 2013 8:40 AM
    Wednesday, January 2, 2013 4:11 PM