CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2006
    Posts
    37

    Problems getting notification for DataGridView

    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.

  2. #2

    Re: Problems getting notification for DataGridView

    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.

  3. #3
    Join Date
    May 2006
    Posts
    37

    Re: Problems getting notification for DataGridView

    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
    Last edited by lagu2653; September 19th, 2006 at 03:40 PM. Reason: Now I understand!

  4. #4
    Join Date
    May 2006
    Posts
    37

    Re: Problems getting notification for DataGridView

    Would forking a thread which updates the datasource every 5 seconds be a good way of doing it?

  5. #5

    Re: Problems getting notification for DataGridView

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured