www.webdeveloper.com
Results 1 to 2 of 2

Thread: Replacing NULL values when selecting from an excel spreadsheet

  1. #1
    Join Date
    Jan 2011
    Posts
    60

    Replacing NULL values when selecting from an excel spreadsheet

    Hi,

    I have the following select statement:


    `Dim rsGetInvoiceContact
    Dim rsGetInvoiceContact_numRows

    Set rsGetInvoiceContact = Server.CreateObject("ADODB.Recordset")
    rsGetInvoiceContact.ActiveConnection = MM_conn_to_EFACs_STRING_ap
    rsGetInvoiceContact.Source = "SELECT * from "& ActinicPersons &" p WHERE p.[Contact ID] = " + Replace(rsGetInvoiceContact__vInvoiceID, "'", "''") + ""
    rsGetInvoiceContact.CursorType = 0
    rsGetInvoiceContact.CursorLocation = 2
    rsGetInvoiceContact.LockType = 1
    rsGetInvoiceContact.Open()

    rsGetInvoiceContact_numRows = 0`

    Later on in my script I plus address line 1 with address line 2. The problem occurs when address line 2 has a NULL value. How can I replace that from the select statement so that if only address line 1 has a value, it will still insert into the database rather than leave a blank cell.

    Thanks

  2. #2
    Join Date
    Jun 2012
    Location
    Dark Side of the Moon
    Posts
    70
    well without code to see I would only venture a guess that the statement IsNull might help you here.

    Code:
    If Not IsNull(rs("address2")) then
    theaddress = rs("address1") & vbcrlf & rs("address2")
    else
    theaddress = rs("address1")
    end if
    Post up if this doesn't help out, but this should point you in the right direction.

    Later
    Burnme

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles