From: jodleren on
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
From: jodleren on
Found it - i is already in use.
I need a break now :)

On Jul 7, 12:56 pm, jodleren <sonn...(a)hot.ee> 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"">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