I have the following code below in a shared function within a self-created namespace. My question is; when and where should I close the datareader and connection. I am assuming that in this example if I close the datareader after 'End While' it will be too late as the the function will have already executed its return of X.
I am assuming the same is true if I close the datareader after the 'End If'
Or am I completely wrong? and if so... where do I close the datareader/connection.
If oDR.HasRows = True Then