|
-
Jun 26th, 2009, 12:51 AM
#1
[RESOLVED] Setting the priority of start-up application/service
I have an app which auto-starts and connects to sql server but the thing is I am not sure if the sql server is started first and from time to time my app encounters an error wherein it cannot connect to the sql server, I would assume it is because sql server hasn't fully started yet or that my application started first, is there something I could do so that my app will wait for sql server to start before connecting?
TIA
-
Jun 30th, 2009, 02:54 AM
#2
Re: Setting the priority of start-up application/service
Okay, this is how I am checking if SQL Server instance is already started before I try connecting to it.
Code:
Public Function SQLServerIsStarted() As Boolean
Dim Process As Object
SQLServerIsStarted = False
For Each Process In GetObject("winmgmts:").ExecQuery("Select * from Win32_Process WHERE Caption = 'sqlservr.exe'")
SQLServerIsStarted = True
Next
End Function
-
Jul 1st, 2009, 10:10 AM
#3
Re: [RESOLVED] Setting the priority of start-up application/service
You could also just check to see if the Microsoft SQL Server service is started using the System.ServiceProcess.ServiceController class couldnt you? (I dont like WMI )
-
Jul 1st, 2009, 10:51 PM
#4
Re: [RESOLVED] Setting the priority of start-up application/service
 Originally Posted by chris128
You could also just check to see if the Microsoft SQL Server service is started using the System.ServiceProcess.ServiceController class couldnt you? (I dont like WMI  )
Its for VB6. But thanks for the info.
-
Jul 2nd, 2009, 03:25 AM
#5
Re: [RESOLVED] Setting the priority of start-up application/service
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|