Mam rekordów takiego:Jaka jest różnica między "Null" i "Nic" w VB6?
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
I okazało się, że w VB6 rzadko używam „Null” (użyłem go do dokonania oceny pustych nazw schematów rekordów), ale używam „nic” do rzeczy, takich jak obrazy , adodb.connections lub zestawy rekordów. Dla łańcuchów mam vbNullString. Czytam, że jest to wskaźnik do łańcucha pustego.
Czy "Null" jest jak "nieznana wartość zmiennej" i "Nic" prawdziwą wartością pustą?
Istnieje "Empty", inna wartość wariantu. – Bob77
... co zasadniczo oznacza "niezainicjowany". –