inetserver asp db:
Greetings,
I have a question about a database query from an asp page. My query is
functional and produces the data that I need; however, one column
contains a numeric value that I need to translate to a name. For
example, the number 1 needs to show up as "VZE" on the loaded web page.
The second column will be the number of tickets, this will not need to
be modified.
This is the current resulting web page:
Vendor Statistics
1 50
2 12
3 8
4 18
5 8
6 5
7 13
8 14
10 3
11 44
This is the code to the query and page layout.
<%@Language=VBScript%>
<!-- #include virtual="adovbs.inc" -->
<HTML><HEAD><META HTTP-EQUIV="Content-Type"
CONTENT="text/html;charset=windows-1252"><TITLE>O/NM</TITLE></HEAD><BODY
[quoted text, click to view] >
<%
If IsObject(Session("s1a_conn")) Then
Set conn = Session("s1a_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "s1a","UID","pwd"
Set Session("s1a_conn") = conn
End If
sql = "SELECT DISTINCT Count(dbo.tbl_common_ticket.vendor_code) AS
ticket_number, dbo.tbl_common_ticket.vendor_code AS vendor_description
FROM dbo.tbl_common_ticket WHERE
(((dbo.tbl_common_ticket.ticket_status_code)=3) AND
((dbo.tbl_common_ticket.work_queue_code)=1)) GROUP BY
dbo.tbl_common_ticket.vendor_code ORDER BY
dbo.tbl_common_ticket.vendor_code "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, -1, -1
If rs.eof Then
rs.AddNew
End If
Set Session("VZE_O_NM_rs") = rs
%>
<TABLE width=100px border=0px align=left>
<THEAD>
<TH colspan="2">
<font face="courier" size="1" COLOR=#000000>Vendor
Statistics</FONT></TH>
</THEAD>
<TBODY>
<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
rs.Fields("vendor_description").Value = vendor_name
select case vendor_name
case 1 vendor_name "VZE"
case else vendor_namee "Other"
End Select
%>
<TR VALIGN=TOP>
</TR>
<TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><font face="courier" size="1"
COLOR=#000000><%=Server.HTMLEncode(rs.Fields("vendor_description").Value
)%></font></b></td>
<TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><font face="courier" size="1"
COLOR=#000000><%=Server.HTMLEncode(rs.Fields("ticket_number").Value)%></
FONT></TD>
<%
rs.MoveNext
loop
%>
</TBODY>
</TABLE>
</BODY>
</HTML>
Any help in working with this formatting is appreciated.
Thanks,
Brandon
*** Sent via Developersdex
http://www.developersdex.com ***