Q:

data is Null. This method or property cannot be called on null values - if statement hasn't worked

I am trying to run this code in VB.net
SQL = "SELECT SUM(amount) FROM billing_payments WHERE invoice_sequence = '" & reader.GetString(0) & "';"
            myCommand2.Connection = conn2
            myCommand2.CommandText = SQL
            reader2 = myCommand2.ExecuteReader
            If reader2.Read Then
                If Not IsDBNull(reader2.GetString(0)) Then
                    account_balance = (account_balance - reader2.GetString(0))
                End If
            End If
            reader2.Close()

Which works fine if there is data returned but when there is no data, I get an error message saying:
data is Null. This method or property cannot be called on null values
I have tried adding in the IF statement to check if the data is NULL but that hasn't worked.
Have I added this in incorrectly?

A:

If reader2 <> Nothing Then
    If reader2.Read Then
        If Not reader2.IsDBNull(0) Then
        '...
        End If
    End If
End If

