SQL database not updating?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can retrieve using fill(), the insert and update statements are there, i
use the auto-generated edit and summary pages, but the edit never seems to
update the data on the database. I've tried doing a few things, looking at
MSDN's instructions, but nothing seems to work. Is there a trick to get it
to work correctly?

-Edgars
 
Common reasons for that:



- Not calling DataAdapter.Update() (or typed TableAdapter.Update) which
actually does the update.

- Calling DataSet.AcceptChanges() before (or instead) DataAdapter.Update().


--
Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
I tried calling the TypedTableAdapter.Update() before and after, neither of
which seemed to work. I created a test project with just a datagrid and a
database, leaving any extras out. I use the smart tag option on the data
grid to create details and edit pages.

Is this by itself supposed to save changes to the database?
I see that it only calls EndEdit(). Should EndEdit automagically update the
database, or does that only finalize the data grid and we need to call
Update() on the table adapter befroe?
 
OK, using TableAdapter.Update(DataSet) or TableAdapter.Update(DataRow) both
return 0, and looking at the docs, that means 0 rows updated. If i use the
direct insert with the sql parameters, it works just fine for updating, but i
have to then programaticly check if i need to do an insert() instead.

So this leads me to a few more questions.

1) Does Update(DataSet) and Update(DataRow) not work correctly on the
compact framework (WM5 PocketPC Device)?

2) if it fails and gives 0 return, is there a way how to tell what error was
given on attempted rows, or which rows were even attempted?

3) if the row was newly added, does the Update() do the insert
automatically, or do we programatically have to determine Insert()'s?

i want do do this the "right" way instead of coding redundant procedures if
they aren't needed.
 
Back
Top