Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C# Offline Mode

Posted on 2006-06-19
5
Medium Priority
?
993 Views
Last Modified: 2008-02-26
Hello experts,

I am creating a distributed application which utliizes a central database to manage data.  I would like allow users to store some data offline so that, in the case that they are not connected to the internet or the SQL server is down, they are still able to view existing data and perform offline functions.

There are two problems I have with this implementation.

(1) How can I check whether the user is connected to the internet or not
(2) How can I check whether the SQL server is running (assuming the user is online)

Thanks,

-T
0
Comment
Question by:TLevin10
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
dttri earned 1000 total points
ID: 16935832
Greetings,
(1): You can check internet connection with this:
http://www.codeproject.com/cs/internet/internetconnection_status.asp
(2): To check the SQL Server is running or not, just connect to it (assume that your internet connection is OK) using a username and password and get the result back.

Hope this help
0
 

Author Comment

by:TLevin10
ID: 16936681
Hi dttri,

Thanks for the quick response.

(1) Checking Internet Connection - This is a very interesting approach and I will try it out.  Good information :)

(2) Checking SQL Server - Maybe I'm wrong, but this seems like a bit of a hack - I don't want to be constantly trying to connect to the SQL server in order to check its status, causing excess traffic.  Is there some sort of function to do this which is not a try/catch block I am executing repeatedly, or am I just responsible for wrapping all of my SQL queries in a try/catch and catching the SQL Excpetion?

Thanks
0
 
LVL 7

Expert Comment

by:dttri
ID: 16949032
Hi TLevin10,
For the second question, I think using the way I mentioned will cost bandwidth, but it's not a bad idea ;). You can use the reverse: get SQL Server let you know that it's running by constant sending your program some signal at specific interval. But this way will cost bandwidth also! I think most of the programs using one of the ways I suggest. The different is the time interval to check. The shorter time, the more correct your get but the more traffic also. Do you know Yahoo! Messenger? I use it everyday and I think it display the online status of users by constant checking connection with them. Because of the way it check online status, it's not perfect; for example, when someone get disconnected suddenly (eg, because of power problem) it still display their status as "online" although it's not.
0
 

Author Comment

by:TLevin10
ID: 16951538
Interesting... I will award the points, since it seems there are a variety of solutions to the problem...
0
 
LVL 7

Expert Comment

by:dttri
ID: 16952840
Thanks for the points TLevin10 :-)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

885 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