C
cj2
If I have a web service like:
<WebMethod()> _
Public Function Validate(ByVal order As String, ByVal requestor As
String) As String
Using mySqlConnection As New SqlConnection(...connection string...)
do some stuff
if something
return "Orders shipped"
endif
do lots and lots more stuff
end using
return orderstatus
end function
If the program determines early in the code that the order is shipped
and I just return from there that it's shipped--I've jumped out of the
using block--does mySqlConnection get closed up and disposed of just
like I'd exited the using block or do I have to pass the end using in
order for the sql connection to get cleaned up?
<WebMethod()> _
Public Function Validate(ByVal order As String, ByVal requestor As
String) As String
Using mySqlConnection As New SqlConnection(...connection string...)
do some stuff
if something
return "Orders shipped"
endif
do lots and lots more stuff
end using
return orderstatus
end function
If the program determines early in the code that the order is shipped
and I just return from there that it's shipped--I've jumped out of the
using block--does mySqlConnection get closed up and disposed of just
like I'd exited the using block or do I have to pass the end using in
order for the sql connection to get cleaned up?