Solved

C# Offline Mode

Posted on 2006-06-19
5
984 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 250 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now