Me.OleDbDataAdapter1.Update(Me.DataSet11.Tables("employee"))

I am trying to update a table with the following code, but it doesn't make any change though there is no error message.
is there any thing wrong with the code.

Me.OleDbDataAdapter1.Update(Me.DataSet11.Tables("employee"))
ChuckbuchanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Try this instead:

  Me.OleDbDataAdapter1.Update(Me.DataSet11)

Bob
Bob LearnedCommented:
Make sure that you haven't used DataSet.AcceptChanges beforehand.

Bob
ChuckbuchanAuthor Commented:
you mean this way
Me.DataSet11.AcceptChanges()
        Me.OleDbDataAdapter1.Update(Me.DataSet11)
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

ChuckbuchanAuthor Commented:
sorry I should have mentionned that the controls are unbound.

I have textbox1, textbox2, textbox3  that I have modified and I want them to update respectively the fields:
employeecode,employeename,functioncode.

the table name is employee          
Bob LearnedCommented:
I mean don't call AcceptChanges first.  Delete that line or it will mess everything up.

Bob
eventprostrategiesCommented:
well, keep in mind -- the controls are bound to the dataset, not the database ... so, theoretically, you've already changed what's in your textboxes (which are bound to the dataset, so you've changed the dataset) ... the only way you'll be able to see the .Update is if you check the database values before and after the .Update or if you close/reopen the application ... you should see that the values were saved to the database
ChuckbuchanAuthor Commented:
so this code couldn't get   the table updated , so far

 Me.OleDbDataAdapter1.Update(Me.DataSet11)
Bob LearnedCommented:
This is check code:

Dim dsChanges As DataSet = Me.Dataset11.GetChanges()

Dim dtTest As DataTable = dsChanges.Tables(0)

Dim recordsCount As Integer = dtTest.Rows.Count

Tell me what recordsCount equals.  My guess is that will equal 0, which indicates that the dataset doesn't have any rowstates that indicates a change.

Bob

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChuckbuchanAuthor Commented:
to TheLearnedOne



it gives error:
Object reference not set to an instance of an object.

and it highlights this  line
dtTest As DataTable = dsChanges.Tables(0)



Bob LearnedCommented:
After the Dim dsChanges As DataSet = Me.Dataset11.GetChanges() line executes, does dsChanges represent a valid DataSet or Nothing?

Bob
ChuckbuchanAuthor Commented:
dschanges=nothing
Bob LearnedCommented:
Then, whatever code that you have doesn't any changes to the DataSet, and the Update method will never work correctly.  It will only work if you have changes to make, indicated by dsChanges is a DataSet instead of nothing.

Bob
ChuckbuchanAuthor Commented:
in the databindings I tried to bind to text and tag  to each of the textboxes in the dataset-->table--->field
then I made some changes on the  textboxes and called the update method. it didn't work and don't why.

how to make it work?

textbox1---------if I make change here it should affect             employee table   field employeecode
textbox2---------if I make change here it should affect             employee table   field employeename
textbox3---------if I make change here it should affect             employee table   field functioncode

how can i get the modifications updated in the table?

thanks
Bob LearnedCommented:
Can I see how you tried to bind to the TextBox controls?

Bob
ChuckbuchanAuthor Commented:
In the databindings for each textbox, where it says Text , Tag , I bound both to the same field and I have done that to each textbox.

If you are confused with my explanations, could you please give an example where you you put on a form :
a combobox button  bound to a table and shows the employeecode, and each time you pick employeecode it shows the corresponding employeename, functioncode. and after you modify a name or functioncode you click a button "Updatebutton" and this will update the table where the fields are originated with the new changes made on the textboxes.

thanks

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.