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

  • Thread starter Jon S via DotNetMonster.com
  • 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
 
D

Dan Bass

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.
 
J

Jon S via DotNetMonster.com

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]
 

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