以下链接方式是用的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 & "<BR>"
Response.Write "ASP 的的错误代码:" & Err.Number & "<BR>"
Response.Write "ASP 的的错误说明:" & Err.Description & "<BR>"
Err.Clear
Response.Write "<H4>Oracle OLE 的错误控制</H4>"
Response.write "Oracle OLE的错误代码:" & OraSession.LastServerErr &"<BR>"
Response.write "Oracle OLE的错误说明:" & OraSession.LastServerErrText &"<BR>"
else
Response.write "<center><H3>资料库成功连结</center>"
'关闭资料库
OraDatabase.Close
'Free Session物件
Set OraSession = nothing
End If
%>
</body>
</html>
本文地址:http://com.8s8s.com/it/it9269.htm