【 tulaoshi.com - ASP 】
<html>
<body>
<H3>Retrieve All Records in MYTABLE1 Table ( in Oracle)
Using oo4o</H3>
<table border=1 ID="Table1">
<%
Do While(OraDynaset.EOF = FALSE)
Response.Write("<tr><td>")
Response.write(OraDynaset.Fields("ID"))
Response.Write("</td><td>")
Response.write(OraDynaset.Fields("UserName"))
Response.Write("</td><td>")
Response.write(OraDynaset.Fields("Phone"))
Response.Write("</td><td>")
Response.write(OraDynaset.Fields("Email"))
Response.Write("</td></tr>")
OraDynaset.MoveNext
Loop
'删除OraSession Set OraSession = Nothing
%>
</table>
<a href="javascript:window.history.go(-1 target=_blank)">
Back previous Page</a> |
<a href="index.html"> Back home Page</a>
</body>
</html>
2)更新
<% 'UpdateRecProc.asp -使用ASP的Oracle Objects for OLE更新数据记录
%>
<%
'定义作为OLE对象的变量。
Dim OraSession
Dim OraDatabase
Dim OraDynaset
'从提交的表格中获取字段值
fID = request.form("ID")
fUserName = request.form("UserName")
fPhone = request.form("Phone")
fEmail = request.form("Email")
'创建OraSession对象
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
'通过打开Oracle数据库的一个连接创建OraDatabase对象
Set OraDatabase = OraSession.OpenDatabase("", "user/password", _ Cint(0))
'创建ID= fID的记录的OraDynaset对象
Set OraDynaset = OraDatabase.CreateDynaset(_ "select * from MYTABLE1 where ID= "& fID, cint(0))
'使用Edit方法更新ID=fID记录的字段
Do While(OraDynaset.EOF = FALSE)
OraDynaset.Edit
OraDynaset.Fields("UserName").Value = fUserName
OraDynaset.Fields("Phone").Value = fPhone
&nbs