Drill Down Select - Sample ASP Files Drill-Down Select...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Sample ASP Files – Drill-Down Select (Part 1) Mote’s Notes 4/6/2011 Basic.asp This is not a drill-down, but it forms the basis of our drill-down examples. < stuff deleted > <html> <head> <title>Basic Report</title> <link rel=stylesheet type='text/css' href=' style.css '> </head> <!--#include file=" MyInfo.asp " --> <body> <% ' Open connection to back-end SQL Server database Set conn=Server.CreateObject("ADODB.Connection") conn.CommandTimeout=15 conn.ConnectionTimeout=15 conn.Open BackEnd ' Open employee recordset sql="SELECT * FROM tblEmployee ORDER BY LastName, FirstName" Set rst=Server.CreateObject("ADODB.Recordset") rst.Open sql, conn ' Display employee data (as table/grid) Response.Write("<h3>Employees</h3>") Response.Write("<table border=0>") Response.Write("<tr>") Response.Write("<th align='left'>Name</th>") Response.Write("<th align='center'>EID</th>") Response.Write("<th align='left'>Job Title</th>") Response.Write("<th align='right'>Salary</th>") Response.Write("<th align='left'>Address</th>") Response.Write("<th align='center'>Photo</th>") Response.Write("</tr>") Ignore the cascading stylesheet. You are not responsible for it. Change the myDatabase line in MyInfo.asp to your own SQL Server database.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 CountEmployees=0 SumSalaries=0 CountPhotos=0 Do Until rst.EOF CountEmployees=CountEmployees+1 SumSalaries=SumSalaries+rst("AnnualSalary") FullName=rst("FirstName") & " " & rst("LastName") If Len(rst("City"))>0 Then If Len(rst("State"))>0 Then Address=rst("City") & ", " & rst("State") Else Address=rst("City") End If Else If Len(rst("State"))>0 Then Address=rst("State") Else Address="Unknown" End If End If Response.Write("<tr>") Response.Write("<td align='left'>" & FullName & "</td>") Response.Write("<td align='center'>" & rst("EID") & "</td>") Response.Write("<td align='left'>" & rst("JobTitle") & "</td>") Response.Write("<td align='right'>" & FormatCurrency(rst("AnnualSalary"),0) & "</td>") Response.Write("<td align='left'>" & Address & "</td>") If Len(rst("PhotoURL"))>0 Then
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Drill Down Select - Sample ASP Files Drill-Down Select...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online