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. Database & SysAdmin
  3. Database
  4. HELP: I can't verify text column is empty

HELP: I can't verify text column is empty

Scheduled Pinned Locked Moved Database
databasehelpquestion
3 Posts 2 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.
  • C Offline
    C Offline
    Curious 2009
    wrote on last edited by
    #1

    I am using VB 2008 & MS Access database I have a table WebRateList with 2 columns ResFrom and ResTo defined as DateTime, another column WebID defined as Text (allow Null) When I search:

    strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "#"

    Then it showed "It is in this range!" But if I scan the same row with column WebID must be emptied, it didn't get in (infact the WebID is empty)

    strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = NULL"
    da = New OleDbDataAdapter(strSQL, dbConn)
    dt = New DataTable
    da.Fill(dt)

    If (dt.Rows.Count() > 0) Then
    MsgBox("It is in this range!")
    End If

    Even I defined the following the result is the same

    strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = '' "

    Anyone can help? :doh:

    I 1 Reply Last reply
    0
    • C Curious 2009

      I am using VB 2008 & MS Access database I have a table WebRateList with 2 columns ResFrom and ResTo defined as DateTime, another column WebID defined as Text (allow Null) When I search:

      strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "#"

      Then it showed "It is in this range!" But if I scan the same row with column WebID must be emptied, it didn't get in (infact the WebID is empty)

      strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = NULL"
      da = New OleDbDataAdapter(strSQL, dbConn)
      dt = New DataTable
      da.Fill(dt)

      If (dt.Rows.Count() > 0) Then
      MsgBox("It is in this range!")
      End If

      Even I defined the following the result is the same

      strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = '' "

      Anyone can help? :doh:

      I Offline
      I Offline
      i j russell
      wrote on last edited by
      #2

      You can't use = NULL, you must use IS NULL.

      C 1 Reply Last reply
      0
      • I i j russell

        You can't use = NULL, you must use IS NULL.

        C Offline
        C Offline
        Curious 2009
        wrote on last edited by
        #3

        It worked! Thanks for a very quick help :) :) :)

        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