Solved

Application.exit or Process killing

Posted on 2004-08-16
2
327 Views
Last Modified: 2006-11-17
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/
0
Comment
Question by:djdidge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Desp earned 85 total points
ID: 11808624
you can use
Environment.Exit(Environment.ExitCode)
0
 
LVL 2

Author Comment

by:djdidge
ID: 11808652
thx
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

717 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