Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Replacing text, fails totally

Reply
Thread Tools

Replacing text, fails totally

 
 
jodleren
Guest
Posts: n/a
 
      07-07-2010
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
 
Reply With Quote
 
 
 
 
jodleren
Guest
Posts: n/a
 
      07-07-2010
Found it - i is already in use.
I need a break now

On Jul 7, 12:56*pm, jodleren <(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant.t fails 240 of 272 tests and recurs.t fails 1 of 25 tests on HPUX using perl 5.8.7 dayo Perl Misc 11 12-16-2005 09:09 PM
OSPF Totally stubby area Guan Foo Wah Cisco 1 08-04-2005 01:42 AM
Replacing - and not Replacing... Rob Meade ASP General 5 04-11-2005 06:49 PM
slideshow fails, Firefox debugger also fails lkrubner@geocities.com Javascript 2 12-23-2004 06:22 PM
Forms Authentication Fails Between ASP.NET 1.0 and 1.1 Applications (Cookie Decryption Fails) John Saunders ASP .Net 1 11-18-2003 03:25 PM



Advertisments