Updating databound textboxes immediately after a database change????

  • Thread starter Thread starter Jon S via DotNetMonster.com
  • Start date Start date
J

Jon S via DotNetMonster.com

Hi all

I'm new to C# and ADO.Net. I've managed to insert, update and delete records
from a database but I need to know how to show these changes immediately.
For example : If I delete a record from the database, that deleted record
will remain in my forms textboxes until I restart the program. Is there a
way to remove that record straight away after deleting it from the database??

I expect it is something very simple but I'm not getting it.

Any help will be appreciated?

Jon
 
In short, no. Remember that the data in any bound control is a copy of data
that was extracted from the database at the time the control was bound to
the data. You need to rebind the control to the data if you want a refresh
to take place.

Perhaps set up a timer that polls the database to keep your text boxes up to
date? The catch is if you have users editing these text boxes, then they may
get reset to the data in the database half way through the user typing in
new text.

In general, bind data to your controls on the form's load event, each time
the dialog is displayed.
 
Hi Dan

Thanks for that.

Kind regards
Jon.


Dan said:
In short, no. Remember that the data in any bound control is a copy of data
that was extracted from the database at the time the control was bound to
the data. You need to rebind the control to the data if you want a refresh
to take place.

Perhaps set up a timer that polls the database to keep your text boxes up to
date? The catch is if you have users editing these text boxes, then they may
get reset to the data in the database half way through the user typing in
new text.

In general, bind data to your controls on the form's load event, each time
the dialog is displayed.
[quoted text clipped - 11 lines]
 
Back
Top