janus85_ren
Member
- Joined
- May 9, 2010
- Messages
- 24
- Programming Experience
- 1-3
Public Function SaveData(ByVal strcmd As String) As Integer
Using con As New SqlClient.SqlConnection(GetConnectionString)
Try
con.Open()
Using cmd As New SqlClient.SqlCommand(strcmd, con)
Return cmd.ExecuteNonQuery()
End Using
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Using
End Function
in this code, do the objects con and cmd get disposed because the return statement is placed before the end using statement. thanks
Using con As New SqlClient.SqlConnection(GetConnectionString)
Try
con.Open()
Using cmd As New SqlClient.SqlCommand(strcmd, con)
Return cmd.ExecuteNonQuery()
End Using
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Using
End Function
in this code, do the objects con and cmd get disposed because the return statement is placed before the end using statement. thanks