Click to See Complete Forum and Search --> : SQL question in database driven page
Metroid
10-30-2003, 02:08 PM
I have an asp page that is database driven - basically the page queries a SQL 2000 database. What I want to do is figure out how not to captured a field within a particular row. How would I go about writing the code to say leave out this information contained within one of the rows that I am using to grab information.
Thanks-in-advance.
Hope this makes sense?
gil davis
10-30-2003, 03:23 PM
There has to be something unique in the row that you do not want to display. You can either filter it out of the result set by adding a WHERE clause to the query, or you can leave the query alone and filter it out of the HTML using script.
Without a concrete example (the query, the fields in the table and the data you don't want) that's about all I can suggest.
Metroid
10-30-2003, 04:52 PM
Look at the section (UAINFO) that is commented out. This I would actually rather not show up on the table at all, but I can't figure it out. I am having a coding brain freeze. If someone can just point me in the right direction that would be awesome. I am thinking that I would probably need to do this before I create the table or if I can do it in this 'select case' that would be awesome as well.
Thanks-in-advance
Case "ITP", "ORGTNG", "MISC", "PROF", "BM-SM"
Response.Write (" <TR class=""body-table-borders-cells"">" & Chr(13) & chr(10))
Response.Write (" <TD>" & objRS2("UACODE") & "</TD><TD>" & objRS2("PROCTYPE") & "</TD><TD>" & FormatDate(objRS2("BEGIN_")) & "</TD><TD>" & FormatDate(objRS2("EXPIRE")) & "</TD>" & Chr(13) & Chr(10))
'IF Trim(objRS2("UACODE")) <> "UAINFO" Then
'Response.Write (" " & Chr(13) & chr(10))
IF Trim(objRS2("PDFLINK")) <> "" Then
Response.Write (" <TD align=center><A target=_blank HREF=""http://uanet-3.uanet.org" & objRS2("PDFLINK") & """><IMG SRC=""images\icon_page.gif"" border=0></A><BR>DOC</TD>" & Chr(13) & chr(10))
Else
Response.Write (" <TD></TD>" & Chr(13) & chr(10))
End IF
'End IF
Response.Write (" </TR>" & Chr(13) & chr(10))
Case "UASTARS", "UAOSHA"
Response.Write (" <TR class=""body-table-borders-cells"">" & Chr(13) & chr(10))
Response.Write (" <TD>" & objRS2("UACODE") & "</TD><TD>" & objRS2("PROCTYPE") & "</TD><TD>" & FormatDate(objRS2("BEGIN_")) & "</TD>" & Chr(13) & Chr(10))
Case "CFC", "UAIBEW"
Response.Write (" <TR class=""body-table-borders-cells"">" & Chr(13) & chr(10))
Response.Write (" <TD>" & objRS2("UACODE") & "</TD><TD>" & objRS2("PROCTYPE") & "</TD><TD>" & FormatDate(objRS2("BEGIN_")) & "</TD>" & Chr(13) & Chr(10))
Case Else
Response.Write (" <TR class=""body-table-borders-cells"">" & Chr(13) & chr(10))
Response.Write (" <TD>" & objRS2("UACODE") & "</TD><TD>" & objRS2("PROCTYPE") & "</TD><TD>" & FormatDate(objRS2("BEGIN_")) & "</TD><TD>" & FormatDate(objRS2("EXPIRE")) & "</TD><TD>" & objRS2("FRSTTEST") & "</TD><TD>" & objRS2("RETEST") & "</TD>" & Chr(13) & Chr(10))
IF Trim(objRS2("PDFLINK")) <> "" Then
Response.Write (" <TD ALIGN=center><A target=_blank HREF=""http://uanet-3.uanet.org" & objRS2("PDFLINK") & """><IMG SRC=""images\icon_page.gif"" border=0></A><BR>DOC</TD>" & Chr(13) & chr(10))
Else
Response.Write (" <TD></TD>" & Chr(13) & chr(10))
End IF
Response.Write (" </TR>" & Chr(13) & chr(10))
End Select
objRS2.MoveNext
Loop
Else
Response.Write ("<P>No certification data exists for this record.")
End IF
If intOpenTable = 1 Then Response.Write ("</TABLE>" & Chr(13) & chr(10))
End IF
%>
</TD>
</TR>
</TABLE>
<br><br>
<!--#include file="footer_menu.asp"-->
</body>
</html>
Metroid
11-03-2003, 03:13 PM
The code below is now taking out the UAINFO and UAOFFCR fields I do not want to show, but now it is always showing this field even if there isn't any information. So it is just showing the table with the headers and I don't want that. Any help will be much appreciated.
Thanks-in-advance
Oh, this piece of code is going in after the Case statement including ITP, ORGTNG, MISC, PROF, BM-SM.
IF strCERTTYPE = "MISC" and Trim(objRS2("UACODE")) = "UAINFO" Then
Else
IF strCERTTYPE = "MISC" and Trim(objRS2("UACODE")) = "UAOFFCR" Then
Else