Wrox Programmer Forums
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 March 10th, 2005, 10:03 PM
Friend of Wrox
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default I have records where I need to replace one letter

I have records where I need to replace one letter with another. Can I modify this highlighting code to do that?

What I need to do is to update my table of database where a column has to replace one letter with another.

WHat I have is the "insert into" statement where I duplicated the table (not shown below).

I need your advice on this.

Function Highlight(strText, strFind, strBefore, strAfter)
  Dim nPos
  Dim nLen
  Dim nLenAll

  nLen = Len(strFind)
  nLenAll = nLen + Len(strBefore) + Len(strAfter) + 1

  Highlight = strText

  If nLen > 0 And Len(Highlight) > 0 Then
    nPos = InStr(1, Highlight, strFind, 1)
    Do While nPos > 0
      Highlight = Left(Highlight, nPos - 1) & _
        strBefore & Mid(Highlight, nPos, nLen) & strAfter &_
         Mid(Highlight, nPos + nLen)

      nPos = InStr(nPos + nLenAll, Highlight, strFind, 1)
  End If
End Function
Dim strText, strFind
strText= Highlight(strText, strFind,"<b>", "</b>")
Response.Write strText
Learning of our true origins.

I feel sorry:


Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean
Old March 11th, 2005, 01:15 AM
Friend of Wrox
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts

You can use replace function in SQL server to to the same..

SELECT REPLACE('abcdefghicde','cde','xxx')

Om Prakash
Old March 11th, 2005, 02:29 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post

what I want to work on is this:
  SQL = "SELECT * FROM new_hebrewbibletable WHERE "
  SQL = SQL & "new_text_data LIKE '%" & Keyword & "%' "
Keyword is the name of the textbox. Is there a way to add a second textbox "Keywordb" to tell what to replace with?

Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139

Similar Threads
Thread Thread Starter Forum Replies Last Post
Letter replace in hangman. martoufmarty Javascript How-To 12 June 17th, 2008 12:30 AM
Generating notification letter Ruman29 Access 1 June 28th, 2006 08:17 PM
search first letter keyvanjan Classic ASP Basics 2 May 17th, 2006 01:47 AM
how can i get the drive letter (e.g. F:) of the ne arif_1947 VS.NET 2002/2003 0 October 5th, 2004 12:07 PM
Obtaining a variable from the first letter... starsol Beginning PHP 3 August 18th, 2003 01:49 PM

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