Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


BindingNavigator won't save record

BindingNavigator won't save record

BindingNavigator won't save record

I'm pretty new to VB.NET and I'm trying to create what should be a simple Add/Edit/Save form using a BindingNavigator, BindingSource, and TableAdapter. I dragged the table from the Data Sources Explorer and VB.Net has created the controls (textboxes, comboboxes) that are needed, the BindingNavigator, and also the code that is supposed to work. However when I run the app, click on the "add new" button and then the "save" button, the record never appears in the table. The odd thing is that if I click "add new" and then "save" without entering any data I get an error saying that null values are not allowed, which would be correct. If I add values to the table by hand it has no problem navigating through them, but it will not add a new record or delete an existing record. I'm sure the problem is in the BindingSource or TableAdapter, but I'm lost as to where to go from there. Any suggestions would be well appreciated. Thanks.

RE: BindingNavigator won't save record

Nevermind. It seems to work when you modify the app.config file and include the full path to the database file instead of "system path" or whatever the default is. I'm not sure why if you specifically include it in the app it still has trouble editing it, but it does.

RE: BindingNavigator won't save record

It still won't delete or edit existing records, but it will add records now. Any ideas as to what I could try? Thanks.

RE: BindingNavigator won't save record

BTW, here is the code I'm currently using for the save operation:


   Me.SpecialtyTableAdapter.Update _(Me.CaseInputDataSet.Specialty)

   MsgBox("Update Successful", MsgBoxStyle.OkOnly)
Catch ex as Exception
   MsgBox("Update Failed",MsgBoxStyle.Critical)
End Try

The first time I try the edit of an existing record it says "Update Successful". And when I try to update a record that has not been changed it says "Update Failed", so it is seeing the difference between a changed and unchanged record.

I've also tried:


Me.SpecialtyTableAdapter.UpdateQuery(txtSetupSpecID.Text, _

Where UpdateQuery is:


UPDATE Specialty
SET SpecialtyID = @Param1, Specialty = @Param2

but that changed every record in the table with the updated value. Thanks again.

RE: BindingNavigator won't save record

One more thing I forgot to include. When I set a breakpoint the error I get on the sub procedure is:

"Update requires a valid UpdateCommand when passed collection with modified rows."

The "general help" that is provided with this error isn't much help. It basically says the same thing in different words and mentions some things that have to do with graphics.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close