Error 502, Declared cursor already exist

I have an application that passes the TIBDatabase and TIBTransaction to a
DLL. Inside the DLL, I have a TIBDataset which its database and transaction
set to the TIBDatabase & TIBTransaction passed from EXE.
The problem comes up when I open the TIBDataset for the first time. The
Message Error is: 'Error 502, Declared cursor already exist'.
I tried to do some work around by setting the database connection to false
just before I activated the Dataset. I works, but I'm not sure if this is
the proper way to do this.

Any clues will be appriciated.
Thanks in advanced.