VBScript Replace Function

Author Message
rmlynch25

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 11/17/2011
  • Status: offline
VBScript Replace Function Thursday, November 17, 2011 1:25 PM (permalink)
0
I'm returning an image filename with full path from a Access DB. I'd like to replace the path (c:\projects\www\Uploads\Image.jpg) with the URL (www.URL.com/Uploads/Image.jpg) so that the image can be displayed. I'm attempting the following scripting as a test:
<%[/style]
dim myImage[/style]
dim myresult[/style]
myresult=(Album.Fields.Item("Filename").Value)[/style]
response.write(myresult) & ("<br>")[/style]
Replace (Album.Fields.Item("Filename").Value), "Projects", "Test"[/style]
response.write(myresult)[/style]
response.end[/style]
%>[/style]
This is my output:[/style]
C:\Projects\www\Upload\Image.jpg
C:\Projects\www\Upload\Image.jpg[/style]
Why is the Replace function not replacing "Projects" with "Test"? [/style]
All help is greatly appreciated. [/style]
 
 
 
#1
    ehvbs

    • Total Posts : 3321
    • Scores: 110
    • Reward points : 0
    • Joined: 6/22/2005
    • Location: Germany
    • Status: offline
    Re:VBScript Replace Function Saturday, November 19, 2011 4:19 AM (permalink)
    0
    Replace() is a function that returns the modified (copy) of the source string. So you need
    myresult = Replace(...)
    to change (the content of) this variable.
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 2 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9