Hi, In the code below, I'd like to know if the database connections are closed or not, as the return value is in the datareader loop.
I now always use the return statement at the end of my functions but would like to know anyway if the connections in the function below get closed.
Thanks
Function GetMessageSource(ByVal MessageLocation as String, ByVal MessageID as String) as String
Try
Dim objConnection as New OdbcConnection(InstallInfoClass.GetOfficiumConnString())
Dim sqlGetMessageSource as String
Dim messageSource as String
sqlGetMessageSource = "Select MessageSource From MailInbox WHERE InboxMailID = '" & MessageID & "'"
Dim objCommand as New OdbcCommand(sqlGetMessageSource, objConnection)
Dim objDataReader as OdbcDataReader
objConnection.Open
objDataReader = objCommand.ExecuteReader()
Do While objDataReader.Read()
GetMessageSource = Trim(objDataReader("MessageSource").ToString())
Loop
objDataReader.Close()
objConnection.Close()
Catch objError as Exception
WriteTest(objError.Description)
End Try
End Function
