jw970170
Programmer
- Aug 8, 2005
- 38
I have some code that looks like there is a memory leak (ie...in C++, there would be a memory leak since I didn't release the memory when I created the second instance of mycommand). The code is below
Dim myCommand As New SqlCommand(myDropTable, Conn)
Try
myCommand.ExecuteNonQuery()
Catch myException As Exception
'MsgBox(myException.ToString())
'Nothing to delete for now
End Try
'Possible memory leak?? VB vs C++
myCommand = New SqlCommand(myCreateTable, Conn)
In VB, do I have to release the memory somehow . Should I do something like
delete myCommand
'Possible memory leak?? VB vs C++
myCommand = New SqlCommand(myCreateTable, Conn)
Thanks in advance
Dim myCommand As New SqlCommand(myDropTable, Conn)
Try
myCommand.ExecuteNonQuery()
Catch myException As Exception
'MsgBox(myException.ToString())
'Nothing to delete for now
End Try
'Possible memory leak?? VB vs C++
myCommand = New SqlCommand(myCreateTable, Conn)
In VB, do I have to release the memory somehow . Should I do something like
delete myCommand
'Possible memory leak?? VB vs C++
myCommand = New SqlCommand(myCreateTable, Conn)
Thanks in advance