Salve a tutti, vorrei sapere, avendo scritto il codice che segue, come inserire una query al database che permette di ricavarmi il nome della categoria padre, solo se il controllo

codice:
<%if Rs("IDCatParent")<>0 then %>
va a buon fine. Ecco il codice:

codice:
<%
sql="SELECT * FROM Categorie ORDER BY NomeCategoria ASC"
Set OBJConn = server.createobject("ADODB.Connection")
OBJConn.ConnectionString=FonteDati
OBJConn.open
set RS=server.CreateObject("ADODB.Recordset")
RS.Open sql,objconn,1,1
iCount = 0 
Do While Not Rs.Eof
if (iCount MOD 2) = 0 Then
	classe="tabellaCeleste"
else
	classe="tabellaBlu"
end if
%>
<%if Rs("IDCatParent")<>0 then %>
  <tr> 
    <td colspan="3" class="<%= classe %>"><%= Rs("NomeCategoria") %></td>
    
    <td class="<%= classe %>" width="17%"><div align="center">
	<%
	LinkEdit = "Javascript:PopUp('editSottoCategoria.asp?IDCat=" & Rs("IDCategoria") & "&NomeCategoria=" & Rs("NomeCategoria") & "&IDPC=" & RS("IDCatParent")  & "&Cat=1" & "','382','190')"
	LinkDel = "delSottoCategorie.asp?IDCat=" & Rs("IDCategoria")	
	iCount = iCount + 1
	%>
	modifica</div></td>
    <td class="<%= classe %>" width="15%"><div align="center">cancella</div></td>
  </tr>
  <% end if%>
  <% 
	Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing
OBJConn.Close
Set OBJConn = Nothing
%>

Grazie 1000