djdidge
asked on
Application.exit or Process killing
Hi there,
I need to close my application if the db connect fails.... as there is no winforms instance at this point i am led to believe that application.exit will not work. So i believe i need to process.kill
But im not sure of the syntax.
Private Sub connectDB()
Try
conSQL = New SqlConnection()
conSQL.ConnectionString = "Password=oioi;Persist Security Info=True;User ID=meme;Initial Catalog=dbInstance;Data Source=server"
AddHandler conSQL.InfoMessage, New SqlInfoMessageEventHandler (AddressOf conSQL_infomessage)
conSQL.Open()
Catch
MsgBox("Failed to connect to database server", , "Application will exit")
Application.Exit()
End Try
End Sub
Public Sub Main()
Try
connectDB()
PrepComm()
Catch ex As Exception
MsgBox(ex.toString)
Exit Sub
End Try
Application.Run()
End Sub
Sorry about the low points... my last 85! :o/
I need to close my application if the db connect fails.... as there is no winforms instance at this point i am led to believe that application.exit will not work. So i believe i need to process.kill
But im not sure of the syntax.
Private Sub connectDB()
Try
conSQL = New SqlConnection()
conSQL.ConnectionString = "Password=oioi;Persist Security Info=True;User ID=meme;Initial Catalog=dbInstance;Data Source=server"
AddHandler conSQL.InfoMessage, New SqlInfoMessageEventHandler
conSQL.Open()
Catch
MsgBox("Failed to connect to database server", , "Application will exit")
Application.Exit()
End Try
End Sub
Public Sub Main()
Try
connectDB()
PrepComm()
Catch ex As Exception
MsgBox(ex.toString)
Exit Sub
End Try
Application.Run()
End Sub
Sorry about the low points... my last 85! :o/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER