Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6238753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:16:13+00:00 2026-05-24T11:16:13+00:00

We used the VS2010 data connection design wizard to define a connection to a

  • 0

We used the VS2010 data connection design wizard to define a connection to a SQLCe database with just one table (database=”UserMetrics” table=”User”). Try as we might the update doesn’t seem to hold, I’ve been through posts on SO and MSDN but can’t see the glaring error…

        //initialize 
        UserMetricsDataSet umDataSet = new UserMetricsDataSet( );
        UserMetricsDataSetTableAdapters.UserTableAdapter umTableAdapter = new    UserMetricsDataSetTableAdapters.UserTableAdapter( );

        // check that test data is there and count is correct
        umTableAdapter.Fill( umDataSet.User );
        UserMetricsDataSet.UserRow umRow = (UserMetricsDataSet.UserRow)umds.User.Rows[0]; 
        int count = umDataSet.User.Rows.Count; //yep its there

        //lets add some rows
        for (int i = 0; i < 100; i++)
            umDataSet.User.AddUserRow( "smith", (float)54, (float)3, 1);

        umds.User.AcceptChanges( );
        //umTableAdapter.Update(umDataSet.User); //tried this also ... no change...

        // there are now 101 rows !!
        int count = umDataSet.User.Rows.Count; //yep its there
        umRow = (UserMetricsDataSet.UserRow)umds.User.Rows[101];

        //lets double check
        umTableAdapter.Fill( umDataSet.User );
        int count = umds.UserMetris.Rows.Count; //huh!!! count==1 ???
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:16:15+00:00Added an answer on May 24, 2026 at 11:16 am

    I’m assuming umDataSet is the same thing as umds.

    What about?

    UserMetricsDataSet.UserRow umRow = umDataSet.User.NewRow();
    umRow["Name"] = "smith";
    // etc
    umDataSet.User.ImportRow(umRow);
    umDataSet.User.AcceptChanges();
    

    Or what about reversing the order? The TableAdapter.Update() method sends updates back to the database based on the changes in the DataTable. If you accept the changes first, then the RowState is reset on each DataTable row, so there are no updates found to send back to the database.

    From MSDN:

    In order to send the modified data to a database, you call the Update method of a TableAdapter. The adapter’s Update method will update a single data table and execute the correct command (INSERT, UPDATE, or DELETE) based on the RowState of each data row in the table.

    try
    {
        umTableAdapter.Update(umDataSet.User);
        umDataSet.User.AcceptChanges();
    }
    catch (Exception ex)
    {
        // TableAdapter.Update() can throw exceptions
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just tried creating a data connection to a SQL 2000 database in VS2010's Server
I have used visual studio(vs2010) installer to restore a database backup file to the
This fails on VS2010 RC LINQ-to-SQL with the InvalidOperationException Stored procedures cannot be used
We used to use SourceSafe, and one thing I liked about it was that
I have a database with this table: Customer - ID - Phone - Cell
I'm just starting out in MVC world, and I've used a standard MVC template
I used vs2010 to create a project that uses framework 2.0. I can't use
I've used NUnit with VS2008, and now am adapting to MSTest on VS2010. I
I am working on a project using VS2010, WPF, and C#. I used SQL
I'm using VS2010 with the MySQL .NET Connector . My project that used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.