Adding new lines into a Access DB through a Datagrid

Posted on 2004-11-10
Last Modified: 2010-04-17
Here's the code I am using
                        DataSet changedData = table1.GetChanges(DataRowState.Modified);
                        if (changedData != null)
                              int numRows = dataAdapter.Update(changedData, "Haves");
                              MessageBox.Show("Database Updated " + numRows + " rows ok","Success");
                              MessageBox.Show("Nothing to Save","No Changes");
                  catch (Exception ex)
                        MessageBox.Show("Error " + ex.Message);

it has no problem chaging data that is already there but if I add information on a new line I get the nothing to save no changes pop up box

Plase help
Question by:Socrates2k1
    LVL 6

    Accepted Solution

    DataRowState.Modified gets you the modified rows.

    DataSet changedData = table1.GetChanges(DataRowState.Modified);

    Change this to :

    DataSet changedData = table1.GetChanges();

    and let me know how it goes.

    Author Comment

    works Good.. no idea why i never tryed it first
    good work

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    sum28 challenge 31 82
    maxMirror challenge 10 68
    scoresAverage challenge 8 58
    wordmultiple challenge 12 62
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now