Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem retrieving info from recordset 1

Status
Not open for further replies.

kirstenro

Programmer
Jan 19, 2001
3
GB
Hi,

I am displaying titles of certain projects which are a href linked to their project numbers to display the description of the project. It works but the title is being printed out twice. The link to the correct description of the project is fine, really the only problem I am having is that the title is being printed twice.

--------------------------------------
Ex (both clickable and link to the same project description):
• Littérature allemande: Wolfgang Hilbig.
• Littérature allemande: Wolfgang Hilbig.

Il y a 1 fiche trouvé.
(translated--"there was 1 document found".)
--------------------------------------
I assume this is because of my SELECT statement (listed below) but how can this be solved? Is it a question of syntax?

Here is the code and thanks in advance:
<%
strFieldName = Request(&quot;Column&quot;)
strTableName = Request(&quot;Table&quot;)
strOrderByField = Request(&quot;OrderBy&quot;)
strPID = Request(&quot;ProjNum&quot;)

SValue = Request(&quot;SValue&quot;)
SType = Request(&quot;SType&quot;)


SQL = &quot;SELECT &quot; &amp; strFieldName &amp; &quot;, &quot; &amp; strPID &amp; &quot; FROM &quot; &amp; strTableName &amp; &quot; WHERE &quot;
for i = 1 to WordCounter
if SType = &quot;AllWords&quot; then
if i <> WordCounter then
SQL1 = SQL1 &amp; strFieldName &amp; &quot; LIKE '%&quot; &amp; Word(i) &amp; &quot;%' AND &quot;
elseif i = WordCounter then
SQL1 = SQL1 &amp; strFieldName &amp; &quot; LIKE '%&quot; &amp; Word(i) &amp; &quot;%'&quot;
end if
elseif SType = &quot;AnyWord&quot; then
if i <> WordCounter then
SQL1 = SQL1 &amp; strFieldName &amp; &quot; LIKE '%&quot; &amp; Word(i) &amp; &quot;%' OR &quot;
elseif i = WordCounter then
SQL1 = SQL1 &amp; strFieldName &amp; &quot; LIKE '%&quot; &amp; Word(i) &amp; &quot;%'&quot;
end if
end if
next
if len(strOrderByField) > 0 then
SQL = SQL &amp; SQL1 &amp; &quot; ORDER BY &quot; &amp; strOrderByField
else
SQL = SQL &amp; SQL1
end if
%>

<%
Set dbConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
dbConn.Open &quot;DSN=SearchDB&quot;

Set rsRecords = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsRecords.Open SQL, dbConn, 3
%>

<%
If Not rsRecords.EOF And Not rsRecords.BOF Then
Do While Not rsRecords.EOF
For i = 0 to rsRecords.Fields.Count-1
Response.Write &quot;<li>&quot; _
&amp; &quot;<a href=&quot;&quot;projdesc.asp?projID=&quot; &amp; rsRecords(1) _
&amp; &quot;&quot;&quot;>&quot; _
&amp; rsRecords(0)_
&amp; &quot;</a>&quot;
Next
rsRecords.MoveNext
Loop
Else
Response.Write(&quot;<FONT SIZE=5><B>Fiche non trouvée</B>&quot;)
Response.Write(&quot;</FONT></CENTER>&quot;)
End If
%>

If I substitute the &quot;0&quot;th ele. for the &quot;i&quot;th ele for the rsRecords(0)
as in:
For i = 0 to rsRecords.Fields.Count-1
Response.Write &quot;<li>&quot; _
&amp; &quot;<a href=&quot;&quot;projdesc.asp?projID=&quot; &amp; rsRecords(1) _
&amp; &quot;&quot;&quot;>&quot; _
&amp; rsRecords(i)_
&amp; &quot;</a>&quot;
Next

it prints out the title and the project number like this (this is one record (both items clickable and link to the same project description):
------------------------------------------------------------
• Littérature allemande: Wolfgang Hilbig.
44150001

Il y a -1 fiche trouvé.
------------------------------------------------------------

 
Thanks, that was the problem. I thought that the for....next was neccessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top