Page Does Nothing
am 07.01.2005 21:00:51 von Jim in ArizonaI've become a bit frustrated at this point. What was once a simple project
turned into one more complex that I'm use to.
I originally had this working when it was a single text input field and a
single sql string calling up info from an access 2000 db. I tried to outdo
myself and now I can't get it to work and I have no idea why. I don't get
any error, it just fails to provide any result. This is my first time of
using sub procedures. Here's my code. My lines have autowrapped when I
pasted. I realize that I'm not suppose to enclose the values of
Response.Write in parenthases but I was in a hurry and copied and pasted
what I had previously made in another project. This fact didn't affect this
phonelist page before it grew to using sub procedures and select case. Any
advise on where I went wrong would be appreciated. Thanks.
<%@ Language=VBScript %>
<%
Dim Conn, SQL1, SQL2, SQL3, listing, sorttype
listing = Request.Form("listing")
sorttype = Request.Form("type")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
server.mappath("phonelist.mdb")
Set SQL1 = Conn.Execute("Select name, location, department, number,
extension FROM master WHERE name LIKE '%"& listing &"%' ORDER BY name")
Set SQL2 = Conn.Execute("Select name, location, department, number,
extension FROM master WHERE department LIKE '%" & listing & "%' ORDER BY
name, department")
Set SQL3 = Conn.Execute("Select name, location, department, number,
extension FROM master ORDER BY name")
Sub TBLA
Response.Write("
Response.Write("
"Location
"
Do While NOT SQL1.EOF
Response.Write("
Response.Write(SQL1.Fields("name") & "
Response.Write(SQL1.Fields("location") & "
Response.Write(SQL1.Fields("department") & "
Response.Write(SQL1.Fields("number") & "
Response.Write(SQL1.Fields("extension") & "
SQL1.MoveNext
LOOP
Response.Write("")
End Sub
Sub TBLB
Response.Write("
Department Listing For " &
listing & "
Response.Write("
Response.Write("
"Location
"
Do While NOT SQL2.EOF
Response.Write("
Response.Write(SQL2.Fields("name") & "
Response.Write(SQL2.Fields("location") & "
Response.Write(SQL2.Fields("department") & "
Response.Write(SQL2.Fields("number") & "
Response.Write(SQL2.Fields("extension") & "
SQL2.MoveNext
LOOP
Response.Write("")
End Sub
Sub TBLC
Response.Write("
HHS - All Internal
Numbers
Response.Write("
Response.Write("
"Location
"
Do While NOT SQL3.EOF
Response.Write("
Response.Write(SQL3.Fields("name") & "
Response.Write(SQL3.Fields("location") & "
Response.Write(SQL3.Fields("department") & "
Response.Write(SQL3.Fields("number") & "
Response.Write(SQL3.Fields("extension") & "
SQL3.MoveNext
LOOP
Response.Write("")
End Sub
%>
In
Development
HHS Internal Phone Directory
Please Type A Name.
You
only have to type a portion of the name.
Two letters of the first name
will do.
<%
Select Case sorttype
Case sortemp
TBLA
Case sortdept
TBLB
Case sortall
TBLC
End Select
SQL1.Close
SQL2.Close
SQL3.Close
Set Conn = Nothing
%>