Loss of network connection on Standby.

  • Thread starter Thread starter Tom Lant
  • Start date Start date
T

Tom Lant

Hello everybody,

I have been developing an application in Visual Basic.Net that queries
an SQL database every 15 minutes. My problem arises when the computer
upon which the application is running goes into standby mode. My
application continues to run, but when the "15 minutes" timer fires,
it cannot make the required connection to the database and the
application crashes.

What I really need is something to tell me the status of my computer,
to check whether it is on standby before trying to connect to the
database. Error trapping won't do because the application needs to be
able to tell the difference between physically not being connected to
the network and being connected but unable to connect to the database
because of the standby problem.

Thanks in advance,

Tom
\/\/\/\/\/\/\/
 
Hello,

Tom Lant said:
I have been developing an application in Visual Basic
Net that queries an SQL database every 15 minutes.
My problem arises when the computer upon which the
application is running goes into standby mode. My
application continues to run, but when the "15 minutes"
timer fires, it cannot make the required connection to
the database and the application crashes.

This is a VB.NET language group. Notice that you will have a better
chance to get an answer if you post to the ADO.NET newsgroup in future:

news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Web interface:

http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.adonet
 
If it's ok to manually take it out of standby mode, just fire this from
behind yourtimer and send it MonitorOnPrivate Declare Function SendMessage
Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long

Public Enum MonitorState
MonitorOn = -1
MonitorOff = 2
MonitorStandby = 1
End Enum

Public Sub SetMonitorState(frmForm As Form, eState As MonitorState)
Dim lngResult As Long

lngResult = SendMessage(frmForm.hwnd, &H112, &HF170, eState)
End Sub
 
Your best bet is to not let the computer go into standby in the first place.

Standby is not really a software issue. It is hardware issue. Each
implementation is different. You would have to get to the level of knowing
what make model of PC you are running on...
 
Back
Top