SqlDataAdapter Update() problem

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

Guest

Hi

I have the following problem. When I call the 'Update()' method on my SQL Data Adapter it's updating the record correctly but then it's moving the record so that bound controls on the form display a different record (not necessarily the next record). Here's my code

public bool UpdateRecord(DataRowView dataRowView)

DataRow[] rows = new DataRow[] {dataRowView.Row}

this.sqlDataAdapter1.Update(rows); // moves record?!

. . . .

return true



Does anyone have any ideas what could be causing this? it's driving me crazy! The DataRowView that is passed to this function is the source for bound controls on the form. I'm not using the binding manager but this shouldn't cause the problem described above

Thanks for your help
Alan Scales
 
Hi Alan,

Which row does it change to? Is it the same row each time?

Also, do you know how to get the row's index? If you do, get it and see if
there's a pattern.

You could workaround, probably, by getting PK info on the row you wish to
display, refinding it immediately after the update, and binding to it.

HTH,

Bernie Yaeger

Alan Scales said:
Hi,

I have the following problem. When I call the 'Update()' method on my SQL
Data Adapter it's updating the record correctly but then it's moving the
record so that bound controls on the form display a different record (not
necessarily the next record). Here's my code,
public bool UpdateRecord(DataRowView dataRowView) {

DataRow[] rows = new DataRow[] {dataRowView.Row};

this.sqlDataAdapter1.Update(rows); // moves record?!!

. . . .

return true;

}

Does anyone have any ideas what could be causing this? it's driving me
crazy! The DataRowView that is passed to this function is the source for
bound controls on the form. I'm not using the binding manager but this
shouldn't cause the problem described above?
 
Back
Top