dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Null and SQL Values

  1. #1
    Join Date
    Feb 2007
    Posts
    2

    Smile Null and SQL Values

    Hi!

    I have an ADO recordset with say one field in it.

    rs.fields("field1").Value can be numeric or null

    And I have a function that updates a value into a database row.

    Function1.Update <double>

    The problem is that the function only accepts a double value and some of the values are NULL. The field allows NULL values in SQL Server.

    How do I make this work? Any suggestions are greatly appreciated.

  2. #2
    Join Date
    Oct 2006
    Posts
    1
    Would this work for you:

    If IsNull(rs.fields("field1")) Then
    'process
    Else
    'process using Function1.Update <double>
    End If

  3. #3
    Join Date
    Feb 2007
    Posts
    2

    re: more info

    That would work if my function only has one input. My function actually has numerous inputs.

    Like,

    Function1.AddNew rs.fields("field1").value, rs.fields("field2).value, ...

    Any of the inputs could be NULL. And all of the inputs are double.

  4. #4
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    If IsNull(rs.fields("field1")) or IsNull(rs.fields("field2")) or ... Then
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  5. #5
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You could change your Update function to accept a Variant instead of a Double.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  6. #6
    Join Date
    Feb 2004
    Location
    Sydney, Australia
    Posts
    498
    It doesn't all have to be done on one line :-

    Rs.Open

    rs.AddNew
    rs.fields("field1").value
    rs.fields("field2).value
    etc ....

    rs.Update

    and therefore you can check each 'field' for null ...

Similar Threads

  1. inner join and outer join
    By syedwna in forum Database
    Replies: 11
    Last Post: 09-02-2006, 05:24 AM
  2. Null values in indexes
    By Pep Gómez in forum Database
    Replies: 1
    Last Post: 06-28-2002, 09:12 AM
  3. Getting a large number of identities
    By Colin McGuigan in forum Database
    Replies: 12
    Last Post: 04-15-2002, 07:43 AM
  4. FOR XML Explicit clause in SQL Server 2000
    By reddy in forum Database
    Replies: 1
    Last Post: 06-06-2001, 04:38 PM
  5. Comparing NULL values (VB, ADO, SQL Server)
    By Heather in forum VB Classic
    Replies: 1
    Last Post: 02-08-2001, 04:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center