I have built Databse Windows Form App using SQL 2019 & C# in Visual Studio 2022. In that Windows Form App, I have a DataGridView in bottom side of that form & also I have some text fields on above the DataGridView. When I fill that text fileds and save that values into the Databse table then these values are automatically shown in lower DataGridView. My App is being used by multi users like 8 to 12 users at same time. They do data entry together on their separate systems. I as an Administartor keep my that Form visible in which I have text fileds and DataGridView to watch what is being entered so far. I keep open my Form & I can't see new values entered into the DataGridView until I close that Form and reopen it. How I can see every new values or every update that is being made in Databse Table in DataGrodView without closing and reopening it. enter image description here
Asked
Active
Viewed 104 times
0
-
It would be beneficial to know how you want to update the `DataGridView`. You could refresh the `DataGridView` on a timer. Otherwise you'd have to implement triggers on the database table, see this link for more information [link](https://stackoverflow.com/a/18318496/18278998) – Roe May 16 '22 at 12:49
-
I want that, whenever new record is inserted or deleted, DataGridView should auto refresh itself without closing and reopening it and I could see updated Grid. – Sheikh Muhammad Nawaz May 16 '22 at 13:09
-
I really don't recommend that, instead I would add a refresh button or a refresh on a timer – Roe May 16 '22 at 13:26
-
Could you please explain it with your code. – Sheikh Muhammad Nawaz May 16 '22 at 13:51
-
1could you be more specific about what I should explain? The refresh button calls the same SQL query as the load event. – Roe May 16 '22 at 13:57
-
I do not want a refresh button or any other object that have to be pressed. I just want to look at DataGRidView and it should auto sync with the databse table if in the databse table new rows are inserted, updated or deleted by the users as well. DataGridView should auto sync with databse table and update itself. – Sheikh Muhammad Nawaz May 16 '22 at 17:11
-
Please provide enough code so others can better understand or reproduce the problem. – Community May 17 '22 at 00:53