I made a vcl application and inside of that I have a ITask that will call a procedure that intents to connect to a database a do some processing. The database component is inside the data module, my procedure can reach the database component (FDConnection) but if I call the procedure outside the ITask, calling inside will rise exception because the connection gets is nil.

I made a vcl application and inside of that I have a ITask that will call a procedure that intents to connect to a database a do some processing. The database component is inside the data module, my procedure can reach the database component (FDConnection) but if I call the procedure outside the ITask, calling inside will rise exception because the connection gets is nil.
Why and how to handle that? Should I treat this as a normal thread?

Comments