Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    what's wrong with this code??

    <font color=red>Problem solved. Once again, it was a problem with the memo field data not getting pulled with the select statement. I had to remove the memo field from the query and call it explicitly. Sheesh!!</font color=red>

    I am trying to build an INSERT statement from a field collection in a SQL query. As you may know, apostrophes are field deliminators in SQL Server, so typically you wrap a field with <font face="Georgia">replace(field, "'", "''")</font face=georgia> to escape the apostrophe. However, if the datasource for the field value is NULL you will get 'invalid use of NULL' when running replace.

    SO, I try this

    <font face="Georgia">for each field in myRS

    if len(field) >0 then
    field = replace(field, "'", "''")
    end if

    ValueString = ValueString & "'" & field & "', "

    next</font face=georgia>

    and it STILL bombs with invalid use of NULL.

    ???

    And please don't tell me not to have NULLS in the db -- there's several text boxes in the form and no reason to have a default value for them.

    any ideas?

    TIA <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: what's wrong with this code??

    We never used to have this problem with machine code...!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: what's wrong with this code??

    yeah i need to get back to programming in binary again.

  4. #4
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Juneau, Alaska, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: what's wrong with this code??

    "And please don't tell me not to have NULLS in the db -- there's several text boxes in the form and no reason to have a default value for them."

    I dunno. To me, having a problem with NULLS in the code sounds like a reason to have a default value for the text boxes. But I'm not telling you to eliminate the NULLS-maybe you have a better reason for having them than for not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •