Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Null handling

Null handling

Scheduled Pinned Locked Moved Visual Basic
databasequestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rulle
    wrote on last edited by
    #1

    I wounder how null values from a database can be handled in VB 6/ADO. Is it possible to pass a null value from a recordset to a VB parameter? When I try to pass a null value from a recordset to a VB parameter, it fails and the function is stopped. The parameter types are integer (mapping between datatypes is correct). Am I having a wrong (database-) perspective and try to handle null values in a way that you are not supposed to? Any enlightning response is welcomed!

    D N 2 Replies Last reply
    0
    • R Rulle

      I wounder how null values from a database can be handled in VB 6/ADO. Is it possible to pass a null value from a recordset to a VB parameter? When I try to pass a null value from a recordset to a VB parameter, it fails and the function is stopped. The parameter types are integer (mapping between datatypes is correct). Am I having a wrong (database-) perspective and try to handle null values in a way that you are not supposed to? Any enlightning response is welcomed!

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      The only variable type in VB 6 that can store a null is Variant. But Variant leads to bad programming, usually. You need to put an if before each strongly-typed use of a NULLable database field. That's why some people avoid NULLable fields like hell. "In an organization, each person rises to the level of his own incompetence." Peter's Principle

      R 1 Reply Last reply
      0
      • D Daniel Turini

        The only variable type in VB 6 that can store a null is Variant. But Variant leads to bad programming, usually. You need to put an if before each strongly-typed use of a NULLable database field. That's why some people avoid NULLable fields like hell. "In an organization, each person rises to the level of his own incompetence." Peter's Principle

        R Offline
        R Offline
        Rulle
        wrote on last edited by
        #3

        Thank you Daniel, I think I'll stick to "some People" except were it is really necessairy to use nullvalues! /R

        1 Reply Last reply
        0
        • R Rulle

          I wounder how null values from a database can be handled in VB 6/ADO. Is it possible to pass a null value from a recordset to a VB parameter? When I try to pass a null value from a recordset to a VB parameter, it fails and the function is stopped. The parameter types are integer (mapping between datatypes is correct). Am I having a wrong (database-) perspective and try to handle null values in a way that you are not supposed to? Any enlightning response is welcomed!

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          Rulle wrote: I wounder how null values from a database can be handled in VB 6/ADO You can check the value of something being returned from the recordset with isnull(adors("someField")). :) Nick Parker
          **The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown


          **

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups