Results 1 to 3 of 3

Thread: Exception thrown when saving record modifications to database.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Exception thrown when saving record modifications to database.

    I placed a binding navigator on a windows form that accesses an access table. Everything behaves as expected, except in the case of when I click the save button on the binding navigator. Below is the code for the event:

    Private Sub TblDMPartBaseBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TblDMPartBaseBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.TblDMPartBaseBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me._MasterBase_02DataSet)
    Me.Close()
    End Sub

    The line in italics, above, is where the break takes place and I get the following exception:

    An unhandled exception of type 'System.InvalidOperationException' occurred in SiTechDocumentMaster.00.exe

    Additional information: Update requires a valid UpdateCommand when passed DataRow collection with


    I use the same code, except on a different table, in another project using this same dataset with no issues. I have looked in a lot of places and am unable to discern why this code does not work. Anyone have any ideas?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Exception thrown when saving record modifications to database.

    If it's a different table in a different project it's not the same dataset.

    Regardless, it tells you what the problem is - you're missing an Update SQL Statement in your dataset/adaptor. You can't update the data unless you tell it how to update it. If this (or similar) code worked in a different project then it's probably because it did include the Update Statement.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Re: Exception thrown when saving record modifications to database.

    I think I understand. I was starting to wonder about datasets and different projects using them. So the gist of what I get from you is that the (a) dataset must exist in each project. This sounds like it could get confusing. What I have is an Access database with about 100 tables doing different jobs within the access framework. All of these tables, lookups, lists, etc. are interrelated in that they are used for data for related activities. So then if I have a different dataset of the same database that exists in each project does that mean that when I make changes to the database I need to re-configure each of the datasets in each of the projects?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width