ASP链接ORACLE的程序

80酷酷网    80kuku.com

  oracle|程序|链接以下链接方式是用的ORACLE的专用对像链接方式,移值性不高,但效率挺高的ORACLE专用ODBC 下载

http://otn.oracle.com/software/content.html 需注册

default.asp

-----------------------------------------------------------------

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>资料库连结</title>
</head>

<body>

<h3 align="left">资料库连结测试</h3>

<form method="POST" action="connection.asp">
<p>资料库名称:<input type="text" name="Database" size="20"></p>
<p>使用者名称:<input type="text" name="Name" size="20"></p>
<p>使用者密码:<input type="password" name="Password" size="20"></p>
<p><input type="submit" value="确定"> <input type="reset" value="取消"></p>
</form>
</body>
</html>

connection.asp

-----------------------------------------------------------------------------

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>资料库连结结果</title>
</head>

<body>

<p>测试结果如下:</p>
<%
On Error Resume Next

'连结资料库
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.DbOpenDatabase( _
Request("Database"),Request("Name")&"/"&Request("Password"),0)

If Err.Number > 0 Then

'判断是否发生错误
Response.Write "<H4>ASP的错误控制</H4>"
Response.Write "ASP 的错误来源:" & Err.Source & "
"
Response.Write "ASP 的的错误代码:" & Err.Number & "
"
Response.Write "ASP 的的错误说明:" & Err.Description & "
"
Err.Clear

Response.Write "<H4>Oracle OLE 的错误控制</H4>"
Response.write "Oracle OLE的错误代码:" & OraSession.LastServerErr &"
"
Response.write "Oracle OLE的错误说明:" & OraSession.LastServerErrText &"
"
else
Response.write "<center><H3>资料库成功连结</center>"

'关闭资料库
OraDatabase.Close

'Free Session物件
Set OraSession = nothing
End If
%>
</body>
</html>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: