Replacing text, fails totally

Discussion in 'ASP General' started by jodleren, Jul 7, 2010.

  1. jodleren

    jodleren Guest

    Hi all

    I am copying data from Access to SQL server, and some strings are with
    {95}, where the number is the ASCII code.

    I try to replace it like this:
    stemp3 = rsSource.Fields(i).value
    i = InStr(stemp3, "{")
    do while i > 0
    j = InStr(stemp3, "}")
    if j > 0 then
    log("Was: " & stemp3 & ", " &Mid(stemp3, i+1, j-i-1))
    response.write "<font face=""Arial"">Was: " & stemp3 &
    ", " &Mid(stemp3, i+1, j-i-1)&"</font><br>"
    stemp3 = Mid(stemp3, 1, i-1) & Chr(CInt(Mid(stemp3, i
    +1, j-i-1))) & mid(stemp3, j+1, 1000)
    response.write "<font face=""Arial"">IS now: " &
    stemp3 &"</font><br>"
    log("IS now: " & stemp3 )
    response.flush()
    end if
    i = InStr(i+1, stemp3, "{")
    loop
    stemp2 = stemp2 & "'" & Replace(stemp3, "'", "''") & "', "
    'string

    but only the first and last line works
    if in insert the InStr or anthing else nothing happens, no output. I
    need to restart the server in order to recover from that.

    What can go wrong here?

    WBR
    Sonnich
     
    jodleren, Jul 7, 2010
    #1
    1. Advertising

  2. jodleren

    jodleren Guest

    Found it - i is already in use.
    I need a break now :)

    On Jul 7, 12:56 pm, jodleren <> wrote:
    > Hi all
    >
    > I am copying data from Access to SQL server, and some strings are with
    > {95}, where the number is the ASCII code.
    >
    > I try to replace it like this:
    >             stemp3 = rsSource.Fields(i).value
    >             i = InStr(stemp3, "{")
    >             do while i > 0
    >               j = InStr(stemp3, "}")
    >               if j > 0 then
    >                 log("Was: " & stemp3 & ", " &Mid(stemp3, i+1, j-i-1))
    >                 response.write "<font face=""Arial"">Was: " & stemp3 &
    > ", " &Mid(stemp3, i+1, j-i-1)&"</font><br>"
    >                 stemp3 = Mid(stemp3, 1, i-1) & Chr(CInt(Mid(stemp3, i
    > +1, j-i-1))) & mid(stemp3, j+1, 1000)
    >                 response.write "<font face=""Arial"">ISnow: " &
    > stemp3 &"</font><br>"
    >                 log("IS now: " & stemp3 )
    >                 response.flush()
    >               end if
    >               i = InStr(i+1, stemp3, "{")
    >             loop
    >             stemp2 = stemp2 & "'" & Replace(stemp3, "'", "''") & "', "
    > 'string
    >
    > but only the first and last line works
    > if in insert the InStr or anthing else nothing happens, no output. I
    > need to restart the server in order to recover from that.
    >
    > What can go wrong here?
    >
    > WBR
    > Sonnich
     
    jodleren, Jul 7, 2010
    #2
    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. Steve
    Replies:
    10
    Views:
    581
    Steve
    Jan 13, 2004
  2. =?Utf-8?B?S3VtYXIgU2hhbm11Z2Ft?=

    asp.net fail totally, when i run

    =?Utf-8?B?S3VtYXIgU2hhbm11Z2Ft?=, Mar 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    353
    =?Utf-8?B?S3VtYXIgU2hhbm11Z2Ft?=
    Mar 3, 2004
  3. Paul
    Replies:
    4
    Views:
    2,405
  4. Brown Smith
    Replies:
    1
    Views:
    518
    Frankie
    Jun 25, 2005
  5. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    316
    Chris Hohmann
    Apr 11, 2005
Loading...

Share This Page