If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Apostrophe Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-04-02, 21:08
Wanda Wanda is offline
Registered User
 
Join Date: Nov 2002
Posts: 3
Question Apostrophe Problem

I am a complete ASP newbie and I have to modify/fix someone else's code, so please be very detailed when answering, i.e. where to place the code.

History:
> 1. I have code that when used in a file it dynamically pulls information
> from a text database (database.txt). It is strictly a text file.
>
> 2. The file(s) with the dynamic code also does some image morphing.
>
>
Problem:
> In the database.txt file there is the name O'Brien. The images will not
> morph unless I remove the apostrophe from O'Brien.
>
> This is part of the code in the database.txt file:
> Jane OBrien
> obrien.asp
> Instructional Designer II
> o
> Instructional Design and New Business
>
>
> This is the code in the non database file:
> 'create second counter
> counter2 = 0
>
> 'change the line below if the name of this group changes
> ID = "Instructional Design and New Business"
> %>
>
> <script language="JavaScript1.1">
> <!--
> <%
> 'create the fso object
>
> set fso = Server.Createobject("Scripting.FileSystemObject")
>
> 'create file path to database
>
> abspath = server.mappath(Session("VirtualBasePath")) &
> "\about_sdu\whos_who\"
> path = abspath & "database.txt"
>
> 'open the file
>
> set file = fso.opentextfile(path, 1)
>
> 'create counter
>
> counter = 1
>
> 'search through database
>
> do until file.AtEndOfStream
>
> name = file.ReadLine
> bio = file.ReadLine
> title = file.ReadLine
> alpha = file.ReadLine
> group = file.ReadLine
> file.ReadLine
>
> strG = group
> if trim(group) = ID then
> response.write "var image" & counter & "=new
> Image();" & chr(10) & chr(13) & "image" & counter &
> ".src='../../images/about_sdu/associates/" & name & ".jpg';" & chr(10) &
> chr(13)
> counter = counter + 1
> end if
> do while instr(strG, "/")
> splitGroup = Left(strG, instr(strG, "/") - 1)
> if trim(splitGroup) = ID then
> response.write "var image" & counter & "=new
> Image();" & chr(10) & chr(13) & "image" & counter &
> ".src='../../images/about_sdu/associates/" & name & ".jpg';" & chr(10) &
> chr(13)
> counter = counter + 1
> end if
> strG = Right(strG, len(strG) - instr(strG, "/"))
> if strG <> splitGroup then
> if trim(strG) = ID then
> response.write "var image" & counter
> & "=new Image();" & chr(10) & chr(13) & "image" & counter &
> ".src='../../images/about_sdu/associates/" & name & ".jpg';" & chr(10) &
> chr(13)
> counter = counter + 1
> end if
> end if
> loop
>
> loop
>
> ' close and clean up
>
> file.close
> set file = nothing
> set fso = nothing
> %>
>
>
> //-->
> </script>
> <script language="JavaScript1.2">
> function reapply(){
> setTimeout("slideit()",3000)
> return true
> }
> window.onerror=reapply
> </script>
> <script>
> <!--
> //change speed below (in seconds)
> var speed=3
> var random
> var destHREF
> Link=new Array()
> <%
> 'create the fso object
>
> set fso2 = Server.Createobject("Scripting.FileSystemObject")
>
> 'create file path to database
>
> abspath2 = server.mappath(Session("VirtualBasePath")) &
> "\about_sdu\whos_who\"
> path2 = abspath2 & "database.txt"
>
> 'open the file
>
> set file2 = fso2.opentextfile(path2, 1)
>
> 'create counter
>
> counter2 = 0
>
> 'search through database
>
> do until file2.AtEndOfStream
>
> name = file2.ReadLine
> bio = file2.ReadLine
> title = file2.ReadLine
> alpha = file2.ReadLine
> group = file2.ReadLine
> file2.ReadLine
>
> strG = group
> if trim(group) = ID then
> response.write "Link[" & counter2 & "]='associates/"
> & trim(bio) & "';" & chr(10) & chr(11)
> counter2 = counter2 + 1
> end if
> do while instr(strG, "/")
> splitGroup = Left(strG, instr(strG, "/") - 1)
> if trim(splitGroup) = ID then
> response.write "Link[" & counter2 &
> "]='associates/" & trim(bio) & "';" & chr(10) & chr(11)
> counter2 = counter2 + 1
> end if
> strG = Right(strG, len(strG) - instr(strG, "/"))
> if strG <> splitGroup then
> if trim(strG) = ID then
> response.write "Link[" & counter2 &
> "]='associates/" & trim(bio) & "';" & chr(10) & chr(11)
> counter2 = counter2 + 1
> end if
> end if
> loop
>
>
> loop
>
> ' close and clean up
>
> file2.close
> set file2 = nothing
> set fso2 = nothing
> %>
>
> //-->
> </script>
Reply With Quote
  #2 (permalink)  
Old 11-04-02, 21:36
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Why is the apostrophe giving you a problem ? Is it being imported into a database ?
Reply With Quote
  #3 (permalink)  
Old 11-04-02, 23:49
Wanda Wanda is offline
Registered User
 
Join Date: Nov 2002
Posts: 3
Yes it is...
Reply With Quote
  #4 (permalink)  
Old 11-05-02, 00:29
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Which database ? Try the replace function with vbscript and replace ' (single quote) with '' (2 single quotes). That should fix your problem.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On