Same Problems RRS feed

  • Question

  • Hello all.  I have the same problem that many are reporting here.  I am using an access db.  It is not related to the copy setting.  I have tried all three settings and no go.  Here's the scenario:  I have a datagridview that is bound to a dataset via a bindingsource object.  It was created by dragging the table from the datasources window.  I do not want the user to update the data in the grid as I will be doing it programatically.  I just want it to display the data in the table.

    I generated the following sample code to try and debug the problem:

           Dim rw As CIDDataSet1.CidRow = CIDDataSet1.Cid.NewCidRow()
            rw.Name = "foo"
            rw.Number = "foo"
            rw.DateTime = Now
            rw.Key = "FOO"

    The ID column for this table is an autonumber so I am not updating it's value.  It is included in the dataset but I am hiding the column in the gridview.

    The above code works up the the update point.  No errors are thrown.  After the Cid.rows.add function is called, I can verify that the dataset contains the new row.  It displays in the gridview that is bound through the bindingsource.  I can also validate that the new row exists in the bindingsource's item collection.  The problem is that the update statement simply does not work.  Upon calling the fill method to refresh the dataset, the new row is not there.  I can also visually ascertain that row does not exist by opening access and having a peek at the table.  I have my copy setting to never copy so I know it is not the overwrite problem listed above.  I have also tried using the bindingsource.addnew and endedit methods.  A row is saved to the database in this case, but it is blank.

    If I use the dbdirect insert method, the data does get into the database, but I cannot figure out the best way to rebind the dataset since the dataset does not reflect the dbdirect insert.

    Any help would be appreciated.  I am afraid the MS guys abandoned this thread long ago...
    Thursday, September 7, 2006 3:00 PM


  • OOps.  I realized that I was calling the accept changes before the update statement.  Amazing how such an oversite can completely hose things up.

    Thursday, September 7, 2006 3:03 PM