Re: Datagrid doesn't update

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 04/27/04


Date: Tue, 27 Apr 2004 15:48:30 -0400

Are you sure your dataset .HasChanges before calling update? IF not, calling
update all year won't do anything. And DO NOT CALL acceptchanges before the
update. This will essentially return the rowstates of everything back to
Unchanged and it will physically delete rows marked as Deleted. If you call
AcceptChanges before Update, your DB will never be updated.

ALso, are you getting an exception on update? Make sure it's not wrapped in
try catch with no action being taken...that can mask errors.

If HasChanges is true, your update command is valid you should be able to
update. If no exceptions are thrown, you have a weird problem indeed, but I
don't think it's that.

Let me know.
"Wanda" <wandali@rogers.com> wrote in message
news:11ac19d1.0404271137.2fdc0a18@posting.google.com...
> I am using vb.net and have a bounded datagrid by using SQLDataAdaptor
> and SQLDataSet, it does show the data when it is first loaded. But
> when I change the data on the datagrid, it doesn't update the
> database, even I use AcceptChanges...
>
> What am I missing? What I am expecting is it should update the
> database automatically without doing it manually with the code.
>
> Please help!!!!
>
> Thanks in advance.
> Wanda



Relevant Pages

  • Re: Calling HasChanges() after AcceptChanges() should always return false, right?
    ... HasChanges() will return false) ... returns True after I just called AcceptChanges(). ... So now our testers hit that failed assert occasionally. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Daten werden nicht geschrieben
    ... und anschließend den ausgelesenen Datensatz markieren. ... HasChanges = True, nach dem Update HasChanges = False) ... Prüfe mal deinen Ablauf und die Richtigkeit von AcceptChanges. ... wird da ein Programmzweig falsch durchlaufen und AcceptChanges an der ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Re: Calling HasChanges() after AcceptChanges() should always return false, right?
    ... This assert should never fire unless you're modifying DataSet from another ... Also, do not overuse HasChanges(). ... > returns True after I just called AcceptChanges(). ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Update Database from DataAdapter
    ... Calling Update should do this, but in a case of your DataSet was populated ... will not know anything about underlying database. ... AcceptChanges will reset state of the rows to unmodified and DA will not see ... But i dont know how to update the dataadapter with the ...
    (microsoft.public.data.ado)
  • Re: DataAdapter not updating rows with RowState=Modified
    ... > After accepting changes (AcceptChanges), obviously, your DataSet has ... > no changes anymore (HasChanges is false). ... the query is never called BUT ...
    (microsoft.public.dotnet.framework.adonet)