Datagridview refreshes automatically reflecting changes in database?
-
Hallo I'm developing a C# .Net2 application built around a DGV. Is it possible to have the DGV data refreshed automatically as the underlying data change? I mean, is there any way to automatically PUSH changes from database to the grid (or the BindingSource)? Thanks in advance
-
Hallo I'm developing a C# .Net2 application built around a DGV. Is it possible to have the DGV data refreshed automatically as the underlying data change? I mean, is there any way to automatically PUSH changes from database to the grid (or the BindingSource)? Thanks in advance
I have a no idea what a DGV is. You can create triggers in your DB, and I believe in newer versions of SQL Server, they can run .NET code.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hallo I'm developing a C# .Net2 application built around a DGV. Is it possible to have the DGV data refreshed automatically as the underlying data change? I mean, is there any way to automatically PUSH changes from database to the grid (or the BindingSource)? Thanks in advance
-
I think you ment DataGridView Control by dgv?? If you are using dataadapter object you can easily reflect changes to db. All you need is a timer control, and calling update method of this adapter in Tick event of timer.
Well, that's not very efficient, I assume that's what he's trying to avoid.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, that's not very efficient, I assume that's what he's trying to avoid.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, that's not very efficient, I assume that's what he's trying to avoid.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
hallo and thanks for the replies. By DGV I mean the DataGridView control, but it could be any control showing data. Actually I was trying to avoid a timer, but the underlying database is a SQL2000 thus having no possibility of CLR into T-SQL. As far as I understand, the logic flow would be: data changes > trigger that broadcasts/sends a message > client application "listening" > performs a grid refresh
-
hallo and thanks for the replies. By DGV I mean the DataGridView control, but it could be any control showing data. Actually I was trying to avoid a timer, but the underlying database is a SQL2000 thus having no possibility of CLR into T-SQL. As far as I understand, the logic flow would be: data changes > trigger that broadcasts/sends a message > client application "listening" > performs a grid refresh
Sorry I thought you were trying to send data to database. Now i understood you are trying to refresh grid from database. data changes > trigger that broadcasts/sends a message > client application "listening" > performs a grid refresh is the best way i think
-
hallo and thanks for the replies. By DGV I mean the DataGridView control, but it could be any control showing data. Actually I was trying to avoid a timer, but the underlying database is a SQL2000 thus having no possibility of CLR into T-SQL. As far as I understand, the logic flow would be: data changes > trigger that broadcasts/sends a message > client application "listening" > performs a grid refresh
Yes, your outdated database probably means you have no choice but to use a timer. Unless, you write some sort of external app that broadcasts to all users somehow, when data is changed. It depends on how many users you have, how often data changes, etc.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Yes, your outdated database probably means you have no choice but to use a timer. Unless, you write some sort of external app that broadcasts to all users somehow, when data is changed. It depends on how many users you have, how often data changes, etc.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I have maximum 15 concurrent users (on that particular table in the db) with less than 10 changes per minute: hence, I think I'll go for a timer. Only, I thought that newer .NET brought something better on the argument... Thanks anyway
-
I have maximum 15 concurrent users (on that particular table in the db) with less than 10 changes per minute: hence, I think I'll go for a timer. Only, I thought that newer .NET brought something better on the argument... Thanks anyway
It's your database that is out of date, and your database that is the issue. The database needs to tell your program when it's been changed, or you need to keep asking, those are the two options.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I have maximum 15 concurrent users (on that particular table in the db) with less than 10 changes per minute: hence, I think I'll go for a timer. Only, I thought that newer .NET brought something better on the argument... Thanks anyway
If your implementation utilises
BindingSource
there are several events that you should consider investigating.BindingSource.CurrentChanged
BindingSource.CurrentItemChanged
BindingSource.ListChanged
The last of these is most likely to be of use to you. Here[^] is a link to theBindingSource
reference on MSDN. I am struggling along on 53.6 Kbs at the moment otherwise I would have given links to the events themselves. :) Hope this helps. :)Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”