Thread: VbNull = 1

    #1
  1. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Jun 2004
    Location
    Phx. AZ
    Posts
    221
    Rep Power
    12

    VbNull = 1


    Apperently vbNull is equal to 1, um ok. How do I pass a null value to the db?
    Code:
    cmdSQL.Parameters.Add("@param", SqlDbType.Int).Value = vbNull
  2. #2
  3. Couch Potato Wizard
    ASP Mastermind (5000+ posts)

    Join Date
    Jan 2005
    Location
    India
    Posts
    13,652
    Rep Power
    2685
    well experts say that storing a null value in database is not a good idea, but anyway, have u tried this?
    Code:
    cmdSQL.Parameters.Add("@param", SqlDbType.Int).Value = Null
    Laziness is my religion and Sunday is my God

    Get the Mantra!
  4. #3
  5. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Jun 2004
    Location
    Phx. AZ
    Posts
    221
    Rep Power
    12
    nope, VB thinks I am using a variable. I even tried declaring null as system.dbnull.
  6. #4
  7. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Jun 2004
    Location
    Phx. AZ
    Posts
    221
    Rep Power
    12
    I figured it out. It need the value property.

    Code:
    cmdSQL.Parameters.Add("@param", SqlDbType.Int).Value = system.dbnull.value

    Comments on this post

    • micky agrees : Thanx for sharing the solution;)
  8. #5
  9. Couch Potato Wizard
    ASP Mastermind (5000+ posts)

    Join Date
    Jan 2005
    Location
    India
    Posts
    13,652
    Rep Power
    2685
    glad u sorted it out and thanx for sharing the solution

IMN logo majestic logo threadwatch logo seochat tools logo