Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2004, 05:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default replace function

Hi there

I'm trying to use the replace function but when I use the following code, the page appears blank for the database field in question when I know there is data in it:

this is my code:

<% if not isNull(rsArticle("Detail")) then %>
        <%=replace(rsArticle("Detail"), vbcrlf, "<br>")%></p>
  <% end if %>


hope someone can help

thanks

Adam




 
Old September 20th, 2004, 06:44 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

  I didn't find problem here. Check whether data is there or not.
Otherwise response.write "Hello" in the condition to test whether the
condition is satisfying or not.

-----------
Rajani

 
Old September 20th, 2004, 07:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Hi Rajani - thanks for your post; I've taken the

if then statement out and I get this error when I just use the following code:

    <%=replace(rsArticle("Detail"), vbcrlf, "<br>")%>

this is the error:

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'replace'

/article.asp, line 124

not sure why this is happening....

thanks

Adam


 
Old September 20th, 2004, 09:09 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello Adam,

  Dont remove that IF condition. It must be there.

Jus follow this way


while not rs.EOF
    if not isnull(rs("detail")) then
    Response.Write replace(rs("detail"),vbcrlf,"<br>") & "<br>"
    end if
        rs.MoveNext
    wend
    rs.Close
    set rs=nothing
    conclose


Still getting error, post your code.

----------
Rajani






Similar Threads
Thread Thread Starter Forum Replies Last Post
Extending the Replace Function designdawg Access 9 February 19th, 2008 12:39 PM
Replace Function Query rsm42 ASP.NET 1.0 and 1.1 Basics 4 August 4th, 2007 05:29 AM
replace function keyvanjan Classic ASP Basics 3 May 15th, 2006 12:57 AM
Character replace function? echovue Access 2 December 21st, 2004 01:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.