Hello to all,
Just want to hear your ideas on which of the following code is more efficient.
VB Code:
Dim TotalUnits as Double ' some codes here ... Try Units += ds.Tables(0).Rows(i).Item("UNITS") Catch ex As Exception ' Set Units to zero if error occur. Units = 0 Finally TotalUnits += Units End Try
or using if statement.
VB Code:
' Check if the column UNITS is NULL If IsDBNull(ds.Tables(0).Rows(i).Item("UNITS")) Then Units = 0 Else Units = ds.Tables(0).Rows(i).Item("UNITS") End If ' Add to TotalUnits variable. TotalUnits += Units
Thanks.




Reply With Quote