Author Topic: Datagridview not updated on client PCs  (Read 1225 times)

ashlacoste

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Datagridview not updated on client PCs
« on: July 08, 2015, 04:40:44 PM »
Hi Mkaatr

First of all, thanks a lot for your effort. You really have made me to up programming skill as beginner. Great work you are doing.

However here is my problem:

I have developed a winform application of which is working fine with expected results. Now the problem started after I have installed the application on 2 client machines. The problem I am facing is when client machine one update date, the updated data does not reflect on client machine 2. Take note that I am using sql server standard as my central database server. Furthermore, I have tried to use code like:

dgv.refresh()

but still am not wining kindly assist with an aid of a video how to correct the above mentioned.

Thanking you in advance.

Ashley

mkaatr

  • Administrator
  • Full Member
  • *****
  • Posts: 115
  • Karma: +1/-0
    • View Profile
Re: Datagridview not updated on client PCs
« Reply #1 on: September 08, 2015, 09:22:03 PM »
Hi there...

Refresh will only update the user interface, not update the data. You need to fill the datatable using the dataadapter using the fill method.

ashlacoste

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Datagridview not updated on client PCs
« Reply #2 on: September 09, 2015, 11:40:04 AM »
Hello Mkaatr

Firstly thanks for your reply. However, and to be clear enough of what i want to achieve is this. When changes is made in the database, I need some kind of a trigger to push those changes automatically to the UI instead a refresh button. So in my case is the Datagridview. I have also used a timer to refresh the Datagridview every 30 seconds but I felt like that is not an effective solution and don't know what it will do on the network load if I had 30 client refreshing every 30 seconds.

Please assist or anyone, please

Thanks

Ashley

mkaatr

  • Administrator
  • Full Member
  • *****
  • Posts: 115
  • Karma: +1/-0
    • View Profile
Re: Datagridview not updated on client PCs
« Reply #3 on: September 09, 2015, 06:15:24 PM »
Hello Mkaatr

Firstly thanks for your reply. However, and to be clear enough of what i want to achieve is this. When changes is made in the database, I need some kind of a trigger to push those changes automatically to the UI instead a refresh button. So in my case is the Datagridview. I have also used a timer to refresh the Datagridview every 30 seconds but I felt like that is not an effective solution and don't know what it will do on the network load if I had 30 client refreshing every 30 seconds.

Please assist or anyone, please


Thanks

Ashley

Hi there...

I am not sure that there is a way to notify the application about database change. However you could do the following:

1- create a table containing one record only that is numeric. Set its value to 1.
2- each time you update the database, increase the value of this record by one.
3- your application should check the value of this record every 30 seconds or so. If it is changed, then preform the refresh operation, otherwise do not refresh.

it is not that easy to do, but this is what comes into mind.

yours sincerely.
« Last Edit: September 09, 2015, 06:18:55 PM by mkaatr »