Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Datagridview refreshes automatically reflecting changes in database?

Datagridview refreshes automatically reflecting changes in database?

Scheduled Pinned Locked Moved C#
csharpcssdatabasequestion
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LordZoster
    wrote on last edited by
    #1

    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

    C T 2 Replies Last reply
    0
    • L LordZoster

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • L LordZoster

        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

        T Offline
        T Offline
        Tamer Oz
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • T Tamer Oz

          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.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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.

          T L 2 Replies Last reply
          0
          • C Christian Graus

            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.

            T Offline
            T Offline
            Tamer Oz
            wrote on last edited by
            #5

            By looking the question that he asked i think this method is adequate for this question. I agree that this is not the best way and not very efficient but anything not mentioned about performance, or other ways that already tried.

            1 Reply Last reply
            0
            • C Christian Graus

              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.

              L Offline
              L Offline
              LordZoster
              wrote on last edited by
              #6

              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

              T C 2 Replies Last reply
              0
              • L LordZoster

                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

                T Offline
                T Offline
                Tamer Oz
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                • L LordZoster

                  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

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  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.

                  L 1 Reply Last reply
                  0
                  • C Christian Graus

                    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.

                    L Offline
                    L Offline
                    LordZoster
                    wrote on last edited by
                    #9

                    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

                    C H 2 Replies Last reply
                    0
                    • L LordZoster

                      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

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • L LordZoster

                        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

                        H Offline
                        H Offline
                        Henry Minute
                        wrote on last edited by
                        #11

                        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 the BindingSource 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.”

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups