473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Large piece of text in database?

Hi everybody,

I am looking for a script in which I can replace any word in one table
(which corresponds) to other table with a link....

To for example when the name Bill Clinton is in a large piece of text in
TABLE1 and Bill Clinton is a row in TABLE2 then I want Bill Clinton in the
text to display as a link leading to a page where there's more info on Bill
Clinton from TABLE2

I was thinking something allong the way of:

TEXT = rs("largtext")

for each word in TEXT
if wordintext = rs2("TABLE2") then
TEXT = Replace(TEXT, wordintext,"<a href=info.asp?more=" & rs2("TABLE2ID") &
">" & rs2("TABLE2") & "</a>")
can any body help me?

I am using JET engine with access DB

Thanx in advance

Willem-Jan Selen
Jul 19 '05 #1
6 2347
Sorry can't figure it out.

I want the text in TABLE2 to be searched for a word corresponding to a row
in table2 and when it does the word in the text must be replaced with a
link:

<a href=information.asp?more=<% tbl2("ID") %>><% tbl2("Corresponding")
%></a>

do I use something like?

Function ThrowInSomeLinks(ByRef sText, sWhatToLookFor, sWhereShouldItLinkTo)

while not rs.EOF

ThrowInSomeLinks = Replace(sText, sWhatToLookFor, "<A href=""" &
sWhereShouldItLinkTo & """>" & sWhatToLookFor & "</A>", , , 1)

End Function

rs.moveNext
if rs.EOF
wend
set rs = Nothing
I didn't understand how to set your sWhatToLookFor and sWhereShouldItLinkTo

I don't have to loop through the TABLE2 ?


"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, wait, any instance of sSpecificTextString should be set to be a link?
Okay:
sText = rs.Fields("TABLE2").Value
''close, destroy rs if finished

Function ThrowInSomeLinks(ByRef sText, sWhatToLookFor, sWhereShouldItLinkTo) ThrowInSomeLinks = Replace(sText, sWhatToLookFor, "<A href=""" &
sWhereShouldItLinkTo & """>" & sWhatToLookFor & "</A>", , , 1)
End Function
Response.write ThrowInSomeLinks(sText, "Bill Clinton",
"http://www.billclinton.com")

This is not ideal, as it will change your case to the second argument you
pass, i.e.

If sText= "BILL CLINTON WAS PRESIDENT." and you pass "Bill Clinton" as the
sWhatToLookFor argument, the result will be:

Bill Clinton WAS PRESIDENT.

Ray at work
"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060630007.419378@cache2...
Hi everybody,

I am looking for a script in which I can replace any word in one table
(which corresponds) to other table with a link....

To for example when the name Bill Clinton is in a large piece of text in
TABLE1 and Bill Clinton is a row in TABLE2 then I want Bill Clinton in the text to display as a link leading to a page where there's more info on Bill
Clinton from TABLE2

I was thinking something allong the way of:

TEXT = rs("largtext")

for each word in TEXT
if wordintext = rs2("TABLE2") then
TEXT = Replace(TEXT, wordintext,"<a href=info.asp?more=" &

rs2("TABLE2ID") &
">" & rs2("TABLE2") & "</a>")
can any body help me?

I am using JET engine with access DB

Thanx in advance

Willem-Jan Selen


Jul 19 '05 #2
Okay, then what did you mean when you said Bill Clinton is a row in table 2?
Perhaps what you're really looking for here is a query that joins your two
tables. Post some info about your database like what is described here,
www.aspfaq.com/5006, and then show what query you're currently using.

Ray at work

"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060632896.771230@cache2...
Sorry can't figure it out.

I want the text in TABLE2 to be searched for a word corresponding to a row
in table2 and when it does the word in the text must be replaced with a
link:

Jul 19 '05 #3
I think i am on the road... But I am not staying on it.. Why ?

<%
set rs = db.execute("Select COUNT(eid) from tbldj")

Dim table2(rs.fields.item(0))

x = 0

while not rs.EOF

table2(0) = rs("djname")

x = x + 1

rs.moveNext
if rs.EOF
wend
set rs = Nothing
Function replace_text(msg)
Dim i
if isNull(msg) = false then
for i = 0 to UBOUND(table2)
msg = Replace(msg,table2(i),"<a href='information.asp?" & i & "'>" &
table2(i) & "'>")
next
end if
replace_text = msg
End Function
set rs = db.execute("Select * from tblnewshsf where newsid = " &
Request("id"))
while Not rs.EOF
Dim msg
msg = rs("newsMsg")
msg = replace_text(msg)
out msg
rs.moveNext
if rs.EOF = false then Response.write ""
wend
set rs = Nothing
%>

THis produces the following error
Microsoft VBScript compilation error '800a0402'

Expected integer constant

test.asp, line 6

Dim table2(rs.fields.item(0))
-----------^
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, wait, any instance of sSpecificTextString should be set to be a link?
Okay:
sText = rs.Fields("TABLE2").Value
''close, destroy rs if finished

Function ThrowInSomeLinks(ByRef sText, sWhatToLookFor, sWhereShouldItLinkTo) ThrowInSomeLinks = Replace(sText, sWhatToLookFor, "<A href=""" &
sWhereShouldItLinkTo & """>" & sWhatToLookFor & "</A>", , , 1)
End Function
Response.write ThrowInSomeLinks(sText, "Bill Clinton",
"http://www.billclinton.com")

This is not ideal, as it will change your case to the second argument you
pass, i.e.

If sText= "BILL CLINTON WAS PRESIDENT." and you pass "Bill Clinton" as the
sWhatToLookFor argument, the result will be:

Bill Clinton WAS PRESIDENT.

Ray at work
"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060630007.419378@cache2...
Hi everybody,

I am looking for a script in which I can replace any word in one table
(which corresponds) to other table with a link....

To for example when the name Bill Clinton is in a large piece of text in
TABLE1 and Bill Clinton is a row in TABLE2 then I want Bill Clinton in the text to display as a link leading to a page where there's more info on Bill
Clinton from TABLE2

I was thinking something allong the way of:

TEXT = rs("largtext")

for each word in TEXT
if wordintext = rs2("TABLE2") then
TEXT = Replace(TEXT, wordintext,"<a href=info.asp?more=" &

rs2("TABLE2ID") &
">" & rs2("TABLE2") & "</a>")
can any body help me?

I am using JET engine with access DB

Thanx in advance

Willem-Jan Selen


Jul 19 '05 #4
Ok I had to work harder...!!

I changed the first part an now it worked in one go.. except, it just
changes I gues only table2(0) and not table2(1) and the rest.

"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060635818.789467@cache2...
I think i am on the road... But I am not staying on it.. Why ?

<%
set rs = db.execute("Select COUNT(eid) from tbldj")

Dim table2(rs.fields.item(0))

x = 0

while not rs.EOF

table2(0) = rs("djname")

x = x + 1

rs.moveNext
if rs.EOF
wend
set rs = Nothing
Function replace_text(msg)
Dim i
if isNull(msg) = false then
for i = 0 to UBOUND(table2)
msg = Replace(msg,table2(i),"<a href='information.asp?" & i & "'>" &
table2(i) & "'>")
next
end if
replace_text = msg
End Function
set rs = db.execute("Select * from tblnewshsf where newsid = " &
Request("id"))
while Not rs.EOF
Dim msg
msg = rs("newsMsg")
msg = replace_text(msg)
out msg
rs.moveNext
if rs.EOF = false then Response.write ""
wend
set rs = Nothing
%>

THis produces the following error
Microsoft VBScript compilation error '800a0402'

Expected integer constant

test.asp, line 6

Dim table2(rs.fields.item(0))
-----------^
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, wait, any instance of sSpecificTextString should be set to be a link?
Okay:
sText = rs.Fields("TABLE2").Value
''close, destroy rs if finished

Function ThrowInSomeLinks(ByRef sText, sWhatToLookFor,

sWhereShouldItLinkTo)
ThrowInSomeLinks = Replace(sText, sWhatToLookFor, "<A href=""" &
sWhereShouldItLinkTo & """>" & sWhatToLookFor & "</A>", , , 1)
End Function
Response.write ThrowInSomeLinks(sText, "Bill Clinton",
"http://www.billclinton.com")

This is not ideal, as it will change your case to the second argument you pass, i.e.

If sText= "BILL CLINTON WAS PRESIDENT." and you pass "Bill Clinton" as the sWhatToLookFor argument, the result will be:

Bill Clinton WAS PRESIDENT.

Ray at work
"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060630007.419378@cache2...
Hi everybody,

I am looking for a script in which I can replace any word in one table
(which corresponds) to other table with a link....

To for example when the name Bill Clinton is in a large piece of text in TABLE1 and Bill Clinton is a row in TABLE2 then I want Bill Clinton in

the text to display as a link leading to a page where there's more info on

Bill
Clinton from TABLE2

I was thinking something allong the way of:

TEXT = rs("largtext")

for each word in TEXT
if wordintext = rs2("TABLE2") then
TEXT = Replace(TEXT, wordintext,"<a href=info.asp?more=" &

rs2("TABLE2ID")
&
">" & rs2("TABLE2") & "</a>")
can any body help me?

I am using JET engine with access DB

Thanx in advance

Willem-Jan Selen



Jul 19 '05 #5
OK got it working!!

This is the full code:

<%
set rs = db.execute("Select MAX(djid) from tbldj")
if rs.EOF = false then
x = rs.fields.item(0)
else
x = 0
end if
set rs = Nothing
set rs = db.execute("Select * from tbldj")
Dim table3()
ReDim table3(x)
z = 0

while not rs.EOF
y = rs("djname")
w = rs("djid")
table3(w) = y

z = z + 1

rs.moveNext
if rs.EOF = false then Response.write ""
wend
set rs = Nothing
Function replace_dj(msg)
Dim i
if isNull(msg) = false then
for i = 0 to UBOUND(table3)
msg = Replace(msg,table3(i),"<a href='informatie.asp?artiest=" & i & "'>"
& table3(i) & "</a>")
next
end if
replace_dj = msg
End Function
set rs = db.execute("Select * from tblnewshsf where newsid = " &
Request("id"))
while Not rs.EOF
Dim msg
msg = rs("newsMsg")
msg = replace_dj(msg)
out msg
rs.moveNext
if rs.EOF = false then Response.write ""
wend
set rs = Nothing
%>

Thanx!!

Willem-Jan Selen
"Willem-Jan Selen" <ws****@hotmail.com> wrote in message
news:1060630007.419378@cache2...
Hi everybody,

I am looking for a script in which I can replace any word in one table
(which corresponds) to other table with a link....

To for example when the name Bill Clinton is in a large piece of text in
TABLE1 and Bill Clinton is a row in TABLE2 then I want Bill Clinton in the
text to display as a link leading to a page where there's more info on Bill Clinton from TABLE2

I was thinking something allong the way of:

TEXT = rs("largtext")

for each word in TEXT
if wordintext = rs2("TABLE2") then
TEXT = Replace(TEXT, wordintext,"<a href=info.asp?more=" & rs2("TABLE2ID") & ">" & rs2("TABLE2") & "</a>")
can any body help me?

I am using JET engine with access DB

Thanx in advance

Willem-Jan Selen

Jul 19 '05 #6
Here's a thread discussing a method to replace pharses in text with
links to additional information pages. We coined the term "SmartLinks"
to describe to methodology. It sound like what you may be looking for.
In the future, if you could provide details about the structure of your
tables, you would likely receive more detailed and informative responses
to your questions.

http://groups.google.com/groups?th=25fc5cff9fbc1a57

HTH
-Chris
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but...
11
by: CSN | last post by:
Is it possible to iterate over an array in plpgsql? Something like: function insert_stuff (rel_ids int) .... foreach rel_ids as id insert into table (rel_id, val) values (id, 5);
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
24
by: Salad | last post by:
Every now and then I see ads that state something like "Experience with Large Databases ...multi-gig...blah-de-blah" And I have to laugh. What's the difference between a large or small database? ...
10
by: Avi | last post by:
Hi I need to read in a large set of text files (9GB+ each) into a database table based on fixed width lengths. There are several ways to complete this, but I am wondering if anyone has...
2
by: daniel | last post by:
I have the following scenario. A mysql database running 3 databases. It is version 5.0.27 on Windows XP Prof.. All innodb databases. The one database is particularly large (7.8GB of...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
13
by: JJ | last post by:
I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file...
20
by: Simon Strobl | last post by:
Hello, I tried to load a 6.8G large dictionary on a server that has 128G of memory. I got a memory error. I used Python 2.5.2. How can I load my data? SImon
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.