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("Column"
strTableName = Request("Table"
strOrderByField = Request("OrderBy"
strPID = Request("ProjNum"
SValue = Request("SValue"
SType = Request("SType"
SQL = "SELECT " & strFieldName & ", " & strPID & " FROM " & strTableName & " WHERE "
for i = 1 to WordCounter
if SType = "AllWords" then
if i <> WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%' AND "
elseif i = WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%'"
end if
elseif SType = "AnyWord" then
if i <> WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%' OR "
elseif i = WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%'"
end if
end if
next
if len(strOrderByField) > 0 then
SQL = SQL & SQL1 & " ORDER BY " & strOrderByField
else
SQL = SQL & SQL1
end if
%>
<%
Set dbConn = Server.CreateObject("ADODB.Connection"
dbConn.Open "DSN=SearchDB"
Set rsRecords = Server.CreateObject("ADODB.Recordset"
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 "<li>" _
& "<a href=""projdesc.asp?projID=" & rsRecords(1) _
& """>" _
& rsRecords(0)_
& "</a>"
Next
rsRecords.MoveNext
Loop
Else
Response.Write("<FONT SIZE=5><B>Fiche non trouvée</B>"
Response.Write("</FONT></CENTER>"
End If
%>
If I substitute the "0"th ele. for the "i"th ele for the rsRecords(0)
as in:
For i = 0 to rsRecords.Fields.Count-1
Response.Write "<li>" _
& "<a href=""projdesc.asp?projID=" & rsRecords(1) _
& """>" _
& rsRecords(i)_
& "</a>"
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é.
------------------------------------------------------------
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("Column"
strTableName = Request("Table"
strOrderByField = Request("OrderBy"
strPID = Request("ProjNum"
SValue = Request("SValue"
SType = Request("SType"
SQL = "SELECT " & strFieldName & ", " & strPID & " FROM " & strTableName & " WHERE "
for i = 1 to WordCounter
if SType = "AllWords" then
if i <> WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%' AND "
elseif i = WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%'"
end if
elseif SType = "AnyWord" then
if i <> WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%' OR "
elseif i = WordCounter then
SQL1 = SQL1 & strFieldName & " LIKE '%" & Word(i) & "%'"
end if
end if
next
if len(strOrderByField) > 0 then
SQL = SQL & SQL1 & " ORDER BY " & strOrderByField
else
SQL = SQL & SQL1
end if
%>
<%
Set dbConn = Server.CreateObject("ADODB.Connection"
dbConn.Open "DSN=SearchDB"
Set rsRecords = Server.CreateObject("ADODB.Recordset"
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 "<li>" _
& "<a href=""projdesc.asp?projID=" & rsRecords(1) _
& """>" _
& rsRecords(0)_
& "</a>"
Next
rsRecords.MoveNext
Loop
Else
Response.Write("<FONT SIZE=5><B>Fiche non trouvée</B>"
Response.Write("</FONT></CENTER>"
End If
%>
If I substitute the "0"th ele. for the "i"th ele for the rsRecords(0)
as in:
For i = 0 to rsRecords.Fields.Count-1
Response.Write "<li>" _
& "<a href=""projdesc.asp?projID=" & rsRecords(1) _
& """>" _
& rsRecords(i)_
& "</a>"
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é.
------------------------------------------------------------