Computing.Net > Forums > Web Development > Querying Oracle from ASP

Querying Oracle from ASP

Reply to Message Icon

Original Message
Name: AndrewG1976
Date: August 16, 2005 at 18:18:47 Pacific
Subject: Querying Oracle from ASP
OS: SunOS 5.8
CPU/Ram: 440Mhz/512MB
Comment:

I'm trying to use the below asp page to connect to my Oracle database and display the records but it is not working, there is no error and no records are displayed, just the table headings. Can anyone tell me why?

The web server I am using is Tomcat 4.1. I have a System DSN setup called "test".

I have Oracle 9.2.0.1.0 Server and Client running on my machine.

Thanks.

[code]

<html>
<body>

This is a view on the database</p>
<%
set con = Server.CreateObject("ADODB.Connection")
con.ConnectionString = "DRIVER={Microsoft ODBC for Oracle};" + _
"SERVER=test;UID=system;PWD=system"
con.Open()
sql = "SELECT * FROM EMPLOYEE"
set CurrentRecordset = con.Execute(sql)
%>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="25%">Name</td>
<td width="25%">Age</td>
<td width="25%">Occupation</td>
</tr>
<%
Do while Not CurrentRecordset.EOF
%>
<tr>
<td width="25%"><% = CurrentRecordset("Name") %></td>
<td width="25%"><% = CurrentRecordset("Age") %></td>
<td width="25%"><% = CurrentRecordset("Occupation") %></td>
</tr>
<%
CurrentRecordset.MoveNext()
Loop
%>
</table>
</body>
</html>

[code]

D:\Projects\intranet>sqlplus system/system@test

SQL*Plus: Release 9.2.0.1.0 - Production on Tue Aug 16 12:31:32 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL> SELECT * FROM EMPLOYEE;

NAME AGE OCCUPATION
--------------
Will Williams 25 Electrical engineer
Dave Davidson 34 Museum curator


Report Offensive Message For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Querying Oracle from ASP

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software