Was ist der Unterschied zwischen "Null" und "Nichts" in VB6?

Ich habe ein Recordset wie dieses:

Dim rs as Recordset
Set rs as New Recordset

'... a lot of coding ...

if Err.Number <> 0 Then ' oops, something gone wrong!
    If rs.State <> adStateClosed Then rs.Close
    Set rs = Nothing
end if

' I want to evaluate if rs is Nothing, or Null

if rs is Nothing then 
' this doesn't throw errors, and works well :D
end if

if rs is Null then
' this throws an error of "types not compatible"
end if

if rs = Null then
' this throws an error of "types not compatible"
end if

if isNull(rs) then
' never enters here, isNull(rs) evaluates to False
end if

Ich habe herausgefunden, dass ich in VB6 selten "Null" verwende (ich habe es zum Auswerten leerer Recordset-Schemanamen verwendet), aber ich verwende "Nothing" für Dinge wie Bilder, adodb.connections oder Recordsets. Für Streicher habe ich vbNullString. Ich habe gelesen, es ist ein Zeiger auf eine Null-Zeichenfolge.

Ist "Null" wie ein "unbekannter Variablenwert" und "Nichts" ein wahrer Nullwert?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage