I have a function which returns datatable
Private Function _Read() As DataTable
Dim _cmd As New SqlCommand
Dim _da As New SqlDataAdapter(_cmd)
Dim _dt As New DataTable
With _cmd
.Connection = dbRoot
.CommandTimeout = 0
.CommandText = "SELECT * FROM Table "
End With
Try
_da.Fill(_dt)
Return _dt
Catch ex As Exception
Return Nothing
End Try
End Function
Now i want to get control if error ocurs so i put the code inside the Try Catch block.
How can i check from my program did exception happend ?
Can i set like this
IF _Read = nothing ?