Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

How to exit the process as soon as the ESC key pressed?

$
0
0
Hello All,

How to exit the process as soon as the ESC key pressed?

Code:

private void myProcess(string dtfrom, string dtto)
        {
            try
            {
                string sql = "SELECT * FROM VERY_HUGE_TABLE WHERE CDATE >= '" + dtto + "' AND CDATE <= '"  + dtto + "' ORDER BY ORDER1,ORDER2";
                using (SACommand cmd = new SACommand(sql, new SAConnection(ID.CONNECTIONSTRING)))
                {
                    try
                    {
                        cmd.Connection.Open();
                        using (SADataReader dr = cmd.ExecuteReader())
                        {
                            while (dr.Read())
                            {

                                blah.. blah blah ..
                                save to dataset .. blah blah blah
                            }
                        }
                    }
                    catch (SAException) {  }
                    finally
                    {
                        if (cmd.Connection.State == System.Data.ConnectionState.Open)
                            cmd.Connection.Close();
                    }
                }
            }
            catch { }
            finally { }
        }


Viewing all articles
Browse latest Browse all 42215

Trending Articles