Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

Join Tek-Tips
*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.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

artyk (Programmer) (OP)
26 Feb 07 12:42
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.
artyk (Programmer) (OP)
27 Feb 07 11:39
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.
artyk (Programmer) (OP)
28 Feb 07 12:55
It still won't delete or edit existing records, but it will add records now. Any ideas as to what I could try? Thanks.
artyk (Programmer) (OP)
28 Feb 07 13:10
BTW, here is the code I'm currently using for the save operation:

CODE

Try
   Me.Validate()
   Me.SpecialtyBindingSource.EndEdit()
   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:

CODE

Me.SpecialtyTableAdapter.UpdateQuery(txtSetupSpecID.Text, _
  txtSetupSpecDesc.Text)

Where UpdateQuery is:

CODE

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

but that changed every record in the table with the updated value. Thanks again.
artyk (Programmer) (OP)
28 Feb 07 14:19
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.

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!

Back To Forum

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