void SMS_SENDING()
      {
          while (true)
          {
              if (check_SMS != 0)
              {
                  dbConn_SMS.Close();
                  dbConn_SMS.Dispose();
                  dbConn_SMS.Close();
              }
              check_SMS = 1;

              dbConn_SMS = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Taimoor\Desktop\Workshop\Client servercomunication\Client servercomunication\serversocket\serversocket\RFID_TRACKER.mdb");
              OleDbCommand adcommand       = new OleDbCommand();
              OleDbCommand adcommandupdate = new OleDbCommand();
              adcommand.CommandText = "SELECT * FROM LOG WHERE DATE=#" + DateTime.Now.Date.ToShortDateString() + "# and " + " STATUS='PENDING' ";
              OleDbDataReader read = null;
              adcommand.Connection       = dbConn_SMS;
              adcommandupdate.Connection = dbConn_SMS;
              dbConn_SMS.Open();
              read = adcommand.ExecuteReader();
              string s = null;
              if (read.HasRows)
              {
                  while (read.Read())
                  {
                      if (read[3].ToString().Contains("12/30/1899"))
                      {
                          s = read[3].ToString();
                          s = s.Replace("12/30/1899", " ");
                      }

                      MSG_STR = read[2].ToString()                         //name
                                + " with CARD-ID : " + read[0].ToString()  //cardid
                                + " and Device ID : " + read[1].ToString() //device
                                + " has entered at "
                                + s;                                       //time
                      //+ " " +read[4].ToString();

                      SMSEngine = new SMSCOMMS("COM16");
                      SMSEngine.Open();

                      SMSEngine.SendSMS("0" + read[6].ToString(), MSG_STR);
                      SMSEngine.Close();

                      adcommandupdate.CommandText = " UPDATE LOG SET STATUS='SENT' WHERE CARD_ID=" + read[0].ToString() + "AND DATE= #" + DateTime.Now.ToShortDateString() + "# AND " + "STATUS = 'PENDING'";
                      adcommandupdate.ExecuteNonQuery();
                  }
              }
              dbConn_SMS.Close();
          }
      }
      private void button3_Click(object sender, EventArgs e)
      {
          bool   check = false;
          string com   = "COM";
          int    port  = 1;

          com = "COM" + port.ToString();
          while (!check)
          {
              try
              {
                  SMSCOMMS SMSEngine = new SMSCOMMS(com);
                  check = SMSEngine.Open1();

                  if (check == false)
                  {
                      port = port + 1;
                      com  = "COM" + port.ToString();
                  }
                  else
                  {
                      check       = true;
                      label3.Text = "Connected to PORT : " + com;
                  }
              }
              catch
              {
              }
          }

          /*
           *  dbConn.Open();
           *  dataGrid.DataSource = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Users\Taimoor\Desktop\Workshop\Client servercomunication\Client servercomunication\serversocket\serversocket\RFID_TRACKER.mdb";
           *  dataGrid.Refresh();
           *  this.dataGrid.Refresh();
           *  DataSet ds = new DataSet();
           *  DataTable dt = new DataTable();
           *  ds.Tables.Add(dt);
           *  OleDbDataAdapter dd = new OleDbDataAdapter();
           *  dd = new OleDbDataAdapter("Select * From LOG", dbConn);
           *  dd.Fill(dt);
           *  dataGrid.DataSource = dt.DefaultView;
           *  dbConn.Close();
           */
      }