Solved

C# Contstant Database View

Posted on 2009-03-31
2
342 Views
Last Modified: 2013-11-08
Hello Experts,
I am writing an application in C# for a type of dispatch. Multiple people will use the software to connect to the database and view current dispatch ques. I was planning on simply using the DataGrid View, my question is how I keep that updated, what is the best way to check for changes someone else might have made. I was thinking about using a timer every 500 ms but I am worried abou the number of connections to the database.

Thanks
0
Comment
Question by:sethwhitworth
2 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 250 total points
ID: 24035471
If your SELECT statement is well optimized, that should not be a problem.

screen flicker might be ... or some other paint-time issues.

An automatic refresh would be very annoying if the user is supposed to interact with the grid -- scroll it, check something off on it, or something like that.  But for a view-only scenario that all fits on a single screen, that should work fine.
0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 250 total points
ID: 24039050
i agree with the previous comment that the data refresh will make the grid flicker a little and might annoy the user a little but if you still want to implement then dont update it every 5 seconds as you are thinking of doing

1 update it every 30 seconds
2 and in the updating logic build in one more logic i.e. (assuming you are keeing the last modified datetime of the dispatch record) send the latest dispach update that is already present on the client side to the database and if that time is older than whats there in the database then only update it else leave it like that (will save some processing)
3 when you do an update the  data for dispatch just check the modified date time in the db - if they both match then only update else send an error message back that someone else has updated so the grid needs to be refreshed
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question