Click to See Complete Forum and Search --> : Problems getting notification for DataGridView
lagu2653
September 19th, 2006, 02:58 AM
How do you get automatic notification for a DataGridView so I don't have to poll and manually update the table data in the DataGridView. I've been searching the Internet for good examples but I haven't found any. I want the data to be changed automatically as soon as something happens in the database.
Tom_Hirst
September 19th, 2006, 03:31 AM
What database are you using? If it is SQL Server 2005 then have look at the SqlDependency class. Otherwise I think you will need to do some polling, but this isn't too bad if it is done well.
lagu2653
September 19th, 2006, 03:57 AM
I'm using Mimer SQL. When I poll the VSB keeps scrolling to the top of the table.
Edit:-------------------------------------------------------------------------
Now I understand! You have to poll and update the data source (DataTable or DataView). There's no way for the datagrid to sense changes in the database unless you use that MS database. That's what I thought at first. But then they started to talk about list notifications and I got confused.
/Larra
lagu2653
September 20th, 2006, 02:58 AM
Would forking a thread which updates the datasource every 5 seconds be a good way of doing it?
Tom_Hirst
September 20th, 2006, 03:23 AM
Ideally you should create a thread that checks the database for updates and only updates the datasource if there have been changes. You may need to adjust the structure of the database to acheive this easily.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.