Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page not being seen as an .asp via browser

Status
Not open for further replies.

pkirkley

Programmer
Sep 6, 2001
12
0
0
US
I am trying to connect to a Oracle database using this code. When I go to this page it only displays the HTML in the browser but when I view source I can see all of the asp code. It appears to never do the database connect and sql statement. Any ideas why this does not work?

Thanks

Paul

<%@ Language=VBScript %>
<html>

<head>
<title>Open Positions</title>
</head>

<body leftmargin=&quot;25&quot;>
<%
Option Explicit

Dim Ora_Conn As ADODB.Connection
Dim Ora_Rs As ADODB.Recordset

Dim sql
Dim dept
Dim loc
Dim where
Dim order

dept = Request.querystring(&quot;select1&quot;)
loc = Request.querystring(&quot;select2&quot;)

' The following if block creates the where and orderby clauses for the SQL query.
' The where clause must be custom built based upon the query selections made on the selections made on Default.asp


' Both department and location have a search value - search on both
if dept <> &quot;All&quot; and loc <> &quot;All&quot; then
where = where & &quot; and division2 = '&quot; & dept & &quot;' and division3 = '&quot; & loc & &quot;' &quot;
order = order & &quot; title&quot;

' Only location has search value - search on location
elseif dept = &quot;All&quot; and loc <> &quot;All&quot; then
where = where & &quot; and division3 = '&quot; & loc & &quot;' &quot;
order = order & &quot; division2, title&quot;

' Only department has search value - search on department
elseif dept <> &quot;All&quot; and loc = &quot;All&quot; then
where = where & &quot; and division2 = '&quot; & dept & &quot;' &quot;
order = order & &quot; division3, title &quot;

else
' Both selections are all
order = order & &quot; division2, division3, title &quot;
end if

' Create final SQL query string

sql = &quot; SELECT req_number, formatted_req_number, title, division3, division2, salary_grade, source_posting_date_end FROM swa_posting&quot; & where & order

Response.Write(sql)

' Instanciate the Oracle connection and recordset objects
Set Ora_Conn = New ADODB.Connection
Set Ora_Rs = New ADODB.Recordset

With Ora_Conn
.ConnectionString =
&quot;Driver={Microsoft ODBC for Oracle};Server=dv;Uid=rep;Pwd=rep99;&quot;
.Open
End With


' Open the recordset object -- NOTE: This open method executes the SQL query and populates the resultant table
Ora_Rs.Open sql, Ora_Conn

If Err.Number <> 0 Then
Response.Write &quot;Error with SQL: &quot; & sql & &quot;<BR>&quot; & Err.Description
end if
%>

<h2>Open Positions</h2>
<hr>
<table ID=&quot;Table1&quot;>
<%
Response.Write(&quot;<tr>&quot;)
Response.Write(&quot;<th>Title</th>&quot;)
Response.Write(&quot;<th>Location</th>&quot;)
Response.Write(&quot;<th>Grade</th>&quot;)
Response.Write(&quot;<th>Closes</th>&quot;)
Response.Write(&quot;<th>Department</th>&quot;)
Response.Write(&quot;<th>Requisition #</th>&quot;)

x = true

Do While(Ora_Rs.EOF = FALSE)
if x = true then
Response.Write(&quot;<tr bgcolor = 'CCCCCC'><td>&quot;)
x = false
else
Response.Write(&quot;<tr><td>&quot;)
x = true
end if
Response.Write(&quot;<a HREF=jobdetail.asp?reqid=&quot; & (Ora_Rs.Fields(&quot;req_number&quot;).Value) & &quot;>&quot; & Ora_Rs.Fields(&quot;title&quot;).Value & &quot;<\a>&quot;)
Response.Write(&quot;</td><td>&quot;)
Response.Write(Ora_Rs.Fields(&quot;division3&quot;).Value)
Response.Write(&quot;</td><td>&quot;)
Response.Write(Ora_Rs.Fields(&quot;salary_grade&quot;).Value)
Response.Write(&quot;</td><td>&quot;)
Response.Write(Ora_Rs.Fields(&quot;source_posting_date_end&quot;).Value)
Response.Write(&quot;</td><td>&quot;)
Response.Write(Ora_Rs.Fields(&quot;division2&quot;).Value)
Response.Write(&quot;</td><td>&quot;)
Response.Write(Ora_Rs.Fields(&quot;formatted_req_number&quot;).Value)
Response.Write(&quot;</td></tr>&quot;)
oRS.MoveNext
Loop
%>
</table>

<%
if Ora_Rs.BOF then
Response.Write(&quot;<i>No listings match your search criteria!</i>&quot;)
end if
%>

<%
' Close the Oracle recordset
Ora_Rs.Close

' Close the Oracle connection
Ora_Conn.Close

' Destroy the Oracle connection, recordset, and SQL string objects

Set Ora_Rs = Nothing
Set Ora_Conn = Nothing
Set sql = Nothing
%>
<hr>

<p align=&quot;center&quot;><a href=&quot;javascript:history.back()&quot;>Start Over</a> </p>
</body>
</html>
 
There are two things to double check (I know I've done them myself).
1. Make sure the page is saved as an asp page.
2. Make sure it's running on an IIS or PWS server

If you can see the asp code the server doesn't know it needs to process it.
 
as far as i know, writing ASP codes for database connecting variables is like this
Code:
Dim Ora_Conn
Dim Ora_Rs
Set Ora_Conn = server.createObject(&quot;ADODB.Connection&quot;)
Set Ora_Rs = server.createObject(&quot;ADODB.Recordset&quot;)

hope it helps.

*JJ26* [smile]
 
As mitchb explained, the poage is not being recognized by the web server as a webpage. Therefore noone of the contents are being executed, so it won't be anything concerning the contents of the file.
Double check both of his suggestions and you should find the solution, if that doesn't answer it and you do have IIS installed I would suggest you post a question to the IIS forum, as it is most likely a setting in there.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top