Upon running the exact same code you uploaded, I'm able to connect to my own usb dongle just fine as long as I change the COM port number to be pointing to the COM port that the USB dongle is plugged into.
I would try double-checking that the USB dongle is in the same COM port as the one you are trying to connect to in software. (Device Manager should hold the list of devices associated with COM ports)
Thank you for your reply. I am sure that the COM port is correct, however it still doesn't work. May I ask what firmware version you have loaded onto your dongle?
Firmware version 126.96.36.199
Hardware version 188.8.131.52
Product: CySmart BLE 4.1 USB Dongle