c# stop running

Posted on 2011-10-23
Last Modified: 2012-05-12
How can i make a condition in c#

if (count < 10)

then stop running program
using (MySqlCommand cmd = new MySqlCommand("SELECT COUNT( * ) FROM  `member`  WHERE  `tambol` LIKE  '¿¿¿¿¿¿¿' ", conDatabase))

                        long count = (long)cmd.ExecuteScalar();


                        if (count < 10)
                            exit ;

                    catch (MySqlException ex)

Open in new window

Question by:teera
    LVL 17

    Assisted Solution

    Try return; instead of exit;
    LVL 39

    Assisted Solution

    by:Pratima Pharande
    Try break; instead of exit;

     if (count < 10)

    LVL 43

    Assisted Solution

    instead of exit;
    LVL 9

    Accepted Solution

    break;                        //The break statement terminates the closest enclosing loop
    return;                       //will exit the current method
    Application.Exit();       //exit the application use

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    760 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

    14 Experts available now in Live!

    Get 1:1 Help Now