二.
<%
dim objorasession,objoradb
dim strdbuser,strdbpwd,strdbconn
call connectdb()
sub connectdb()
连接数据库
on error resume next
strdbuser = "tmpuser" 连接用户名
strdbpwd = "rt45ps1w" 用户密码
strdbconn = "sun450" 连接字符串
set objorasession = server.createobject("oracleinprocserver.xorasession")
set objoradb = objorasession.opendatabase(strdbconn,strdbuser & "/" & strdbpwd,0)
if err.number>0 then
response.write "<font color=red>错误 :" & err.description & "</font>"
response.end
end if
end sub
sub enddb()
set objoradb = nothing
set objorasession = nothing
end sub
function gettablelist(str)
dim strsql,strtmp
dim objrs
strsql = "select at.table_name as tname,au.username as uname from all_tables at,all_users au where au.username=at.owner order by au.username"
set objrs = objoradb.dbcreatedynaset(strsql,0)
while not objrs.eof
stra = objrs("uname") & "." & objrs("tname")
if str=stra then
strtmp = strtmp & "<option selected>" & stra & "</option>"
else
strtmp = strtmp & "<option>" & stra & "</option>"
end if
objrs.movenext
wend
set objrs = nothing
gettablelist = strtmp
end function
%>
<form name=form1 action="index.asp" method=post target="main">
<table width="100%" border=0 align="center">
<tr><td>
all tables : <select name="tb">
<%=gettablelist(tblname)%>
</select>
<input type=hidden name="submitc" value="view">
<input type=submit name="submit" value="view data"> <font color=red>(<%=strdbuser & "/" & strdbpwd & "@" & strdbconn%>)</font>
</td></tr>
</table>
</form>