Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a database application in c# which contains a listbox. the listbox regulates movement from one records to another. i have a button called update which updates records on the database when clicked.
i want a code which will auto refresh records on my database when a listbox item is clicked without reloading the form in c#
Posted
Updated 20-Sep-14 6:30am
v2
Comments
BillWoodruff 20-Sep-14 13:13pm    
What are you doing now that causes the Form to be reloaded ?
MaximusDebois 20-Sep-14 13:20pm    
there are times where one change an item in a record in the without saving and click another item in listbox. in this case i want the items in the listbox to auto reload
from the database
AndrewCharlz 21-Sep-14 6:52am    
just use a timer to refresh

1 solution

you can do this by listening to the changes in the database so,
You're looking for the SqlDependency class ,
Change Data Capture


this is example for your bussiness , a chat program listen to database
Using SqlDependency for data change events[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900