Skip to content
October 11, 2012 / doganay

CONNECT ORACLE ON ASP (DSNless)

Change DATABASE_NAME, myOracleUsername, myOraclePassword:

<HTML>
<HEAD>
<TITLE>Connecting to an Oracle database using OLE and DSNLess connection</TITLE>
</HEAD>
<BODY>
<%

SET myConn=SERVER.createobject("adodb.connection")
myConn.Open "Provider=MSDAORA; Data Source=DATABASE_NAME;" & _
"User ID=myOracleUsername;" & "Password=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 Oracle using OLE & DSNLess 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. Maricruz / Apr 15 2013 4:07 pm

    Hello there, I found your web site via Google even as looking for a similar subject, your website came up, it appears to be like great.
    I have bookmarked it in my google bookmarks.

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: