Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts

    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.

    Code:
     
    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

  • #2
    Regular Coder
    Join Date
    Oct 2002
    Posts
    380
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Doesn't VB use an IsNull function...

    if IsNull(rst(i).value) then
    ...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •