Helpful Information
Home
Categories
Contact us
Category: Other Databases
type mismatch with NULL
I'm having a problem checking for a null value in a recordset pulled from an SQL Server Database.
I get a type mismatch error on the if statement.
strSQL = "SELECT * FROM events WHERE UID = 406"
set rst = con.execute(strSQL)
for i = 0 to rst.fields.count - 1
if rst(i).value = NULL then
execute(rst(i).name & "=" & cstr(chr(34)&" "&chr(34)))
else
execute(rst(i).name & "=" & cstr(chr(34)&cstr(rst(i).value)&chr(34)))
end if
next
rst.close
Doesn't VB use an IsNull function...
if IsNull(rst(i).value) then
...
privacy (GDPR)