Replace function - error 80020009

Discussion in 'ASP General' started by Séverine Donnay, Oct 20, 2005.

  1. Hello,

    I try to use the replace function with a very long text and I have this
    error :

    error '80020009'
    Exception occurred.

    Do you have any idee to resolve this problem ?
    Thanks
    Séverine Donnay, Oct 20, 2005
    #1
    1. Advertising

  2. Give the code.

    Ray at work

    "Séverine Donnay" <> wrote in message
    news:wDM5f.11617$...
    > Hello,
    >
    > I try to use the replace function with a very long text and I have this
    > error :
    >
    > error '80020009'
    > Exception occurred.
    >
    > Do you have any idee to resolve this problem ?
    > Thanks
    >
    >
    >
    Ray Costanzo [MVP], Oct 20, 2005
    #2
    1. Advertising

  3. I've just use the replace function. If the text is too long, I have the
    error but if I cut the text, I don't have any error.

    montexte= Replace( montexte, "'", "''" )


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> a écrit dans
    le message de news: #...
    > Give the code.
    >
    > Ray at work
    >
    > "Séverine Donnay" <> wrote in message
    > news:wDM5f.11617$...
    > > Hello,
    > >
    > > I try to use the replace function with a very long text and I have this
    > > error :
    > >
    > > error '80020009'
    > > Exception occurred.
    > >
    > > Do you have any idee to resolve this problem ?
    > > Thanks
    > >
    > >
    > >

    >
    >
    Séverine Donnay, Oct 20, 2005
    #3
  4. Séverine Donnay

    Guest

    Séverine Donnay wrote:
    > I've just use the replace function. If the text is too long, I have the
    > error but if I cut the text, I don't have any error.
    >
    > montexte= Replace( montexte, "'", "''" )


    What's the length of the text when there's an error?
    , Oct 20, 2005
    #4
  5. 146 800

    <> a écrit dans le message de news:
    ...

    Séverine Donnay wrote:
    > I've just use the replace function. If the text is too long, I have the
    > error but if I cut the text, I don't have any error.
    >
    > montexte= Replace( montexte, "'", "''" )


    What's the length of the text when there's an error?
    Séverine Donnay, Oct 20, 2005
    #5
  6. I've never run into this, so all I can suggest is that you handle the text
    in chunks:

    dim strlen,ar(),chunk, i
    strlen=len(montexte)
    if strlen >= <size that causes the error> then
    chunk=2000
    redim ar(strlen\chunk+ 1)
    for i = 0 to ubound(ar)
    ar(i)=replace(mid(montexte,i*chunk + 1,chunk),"'","''") next
    else
    montexte= Replace( montexte, "'", "''" )
    end if

    It looks like you are processing this string to use it in a dynamic sql
    statement. You can avoid this processing by using parameters:
    http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e

    Bob Barrows

    Séverine Donnay wrote:
    > I've just use the replace function. If the text is too long, I have
    > the error but if I cut the text, I don't have any error.
    >
    > montexte= Replace( montexte, "'", "''" )
    >
    >
    > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> a
    > écrit dans le message de news: #...
    >> Give the code.
    >>
    >> Ray at work
    >>
    >> "Séverine Donnay" <> wrote in message
    >> news:wDM5f.11617$...
    >>> Hello,
    >>>
    >>> I try to use the replace function with a very long text and I have
    >>> this error :
    >>>
    >>> error '80020009'
    >>> Exception occurred.
    >>>
    >>> Do you have any idee to resolve this problem ?
    >>> Thanks


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Oct 20, 2005
    #6
  7. Bob Barrows [MVP] wrote:
    > I've never run into this, so all I can suggest is that you handle the
    > text in chunks:
    >
    > dim strlen,ar(),chunk, i
    > strlen=len(montexte)
    > if strlen >= <size that causes the error> then
    > chunk=2000
    > redim ar(strlen\chunk+ 1)
    > for i = 0 to ubound(ar)
    > ar(i)=replace(mid(montexte,i*chunk + 1,chunk),"'","''")
    > next


    oops, I forgot the join statement to put the string back together:
    montexte=join(ar,"")

    > else
    > montexte= Replace( montexte, "'", "''" )
    > end if
    >


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Oct 20, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. olivier Micheli

    ADODB.Field error '80020009

    olivier Micheli, Aug 15, 2003, in forum: ASP General
    Replies:
    0
    Views:
    183
    olivier Micheli
    Aug 15, 2003
  2. psaban

    error '80020009' Exception occurred

    psaban, Jun 10, 2004, in forum: ASP General
    Replies:
    0
    Views:
    139
    psaban
    Jun 10, 2004
  3. M Naeem Baig

    ADSI 80020009 Error on windows 2003

    M Naeem Baig, Jun 14, 2004, in forum: ASP General
    Replies:
    0
    Views:
    192
    M Naeem Baig
    Jun 14, 2004
  4. Chris
    Replies:
    1
    Views:
    219
    Aaron [SQL Server MVP]
    Aug 5, 2004
  5. dmiller23462

    Error code 80020009 "Exception Occured"

    dmiller23462, Aug 17, 2004, in forum: ASP General
    Replies:
    2
    Views:
    290
    dmiller23462
    Aug 18, 2004
Loading...

Share This Page