Disposing of sql connection obeject between functions
Posted on 2010-11-24
I have t functions say A() and B(). Currently in each function i create a sql db connection object in each function. Function A() calls function B(). I want to pass the db connection object from A() to B() as a paramter so i can get rid of creating the db connection object in B().
My question is this, do i still need to dipose of the passed db object in B() by using
DBConnection = Nothing
Or can i dispose of it in function A() ?
I am concerned if i close it in B() then it will no longer be valid in A(), this application is multi trheaded and i have to be ver carefull and make sure i dispose of the objects when each thread is done.
hope this makes sense