Skip to content
October 11, 2012 / doganay

CONNECT TO ORACLE on ASP (using ADODB)

Change oracle11g, myOracleUsername, myOraclePassword:

<HTML>
<HEAD>
<TITLE>Connecting to an Oracle database using ADODB</TITLE>
</HEAD>
<BODY>

<%

SET myConn=SERVER.createobject("adodb.connection")
myConn.Open "DSN=oracle11g;" & _
"Uid=myOracleUsername;" & "Pwd=myOraclePassword"

SQLStr="SELECT empno, ename, deptno FROM Emp ORDER BY deptno, ename"
SET result=myConn.execute(SQLStr)
IF NOT result.EOF THEN
response.write("<H2>Oracle ASP Example</H2>")
response.write("<P>Connecting to the Oracle11g database using ODBC & a DSN connection</P>")
response.write("<TABLE BORDER=3 BGCOLOR=#0099CC><TR><TH>Employee No</TH>" & _
"<TH>Name</TH><TH>Department No</TH>")
WHILE NOT result.EOF
response.write("<TR><TD>" & result("empno") & "</TD>")
response.write("<TD>" & result("ename") & "</TD>")
response.write("<TD>" & result("deptno") & "</TD></TR>")
result.movenext()
WEND
response.write("</TABLE>")
ELSE
response.write("<P>Error retrieving Employee data!!</P>")
END IF
%>
</BODY>
</HTML>
Advertisements

One Comment

Leave a Comment
  1. Vinicius / Mar 12 2014 5:02 pm

    Obrigado, me ajudou muito!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: