public static bool IsLicenseKey_Exist() { string lcKey = Crypting.DeCryptData(); if (lcKey == null) { return(false); } lcKey = lcKey.Replace("\r\n", ""); conn.Open(); string sql = "SELECT * from LicenseTBO WHERE license_key = @license AND duration_key >= @curdate"; //todo: date check MySqlCommand cmd = new MySqlCommand(sql, conn); cmd.Parameters.Add("@license", MySqlDbType.String).Value = lcKey; cmd.Parameters.Add("@curdate", MySqlDbType.DateTime).Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); try { object obj = cmd.ExecuteScalar(); if (obj == null) { conn.Close(); conn.Dispose(); return(false); } conn.Close(); conn.Dispose(); return(true); } catch { conn.Close(); conn.Dispose(); return(false); } }