DataAdapter.Update not working

C

Craig Hoy

I have been trying to get DataAdapter.Update(DataSet) to update a SQL
Server database. I have not been getting any errors but there is no
records in the database when I check Enterprise Manager.

Could someone please help!
 
C

Cor Ligthert [MVP]

Craig,

There are so many posibilities for your error, can you tell us a little bit
more. Did you use the designer, did you use a commandbuilder, did you write
the commands yourself, etc.

Cor
 
W

W.G. Ryan - MVP

Craig Hoy said:
I have been trying to get DataAdapter.Update(DataSet) to update a SQL
Server database. I have not been getting any errors but there is no
records in the database when I check Enterprise Manager.

Could someone please help!
--Craig, two things come to mind. First, make sure that
yourdataSet.HasChanges(); if not , then nothing is going to happen with
your update. http://www.knowdotnet.com/articles/rowstateupdate.html . If you
don't have Changes then there's nothing for the adapter to update. Next, if
that's not the case, run Sql Profiler and call Update and verify what's
being sent to the db. That should shed some insight into the problem.
 
V

Val Mazur \(MVP\)

Craig,

If no error, then most likely DataAdapter does not have anything to update
in a database. If you know for sure that you have made the changes in a
database, then make sure that your code does not call AcceptChanges \before
it calls Update. Also make sure that UPDATE statements or SP that does
updating has proper conditions for the WHERE clause, if it has any

Val Mazur
Microsoft MVP
http://xport.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top