<% response.charset= "gb2312"
Tblname=request ("TB")
Dim objorasession,objoradb
Dim Strdbuser,strdbpwd,strdbconn
Call Connectdb ()
Sub connectdb () ' Connect to the database
On Error Resume Next
Strdbuser = "Liujincai" ' Connection user name
Strdbpwd = "ljc1001" User password
Strdbconn = "HP1" Connection string
Set objorasession = Server.CreateObject ("Oracleinprocserver.xorasession")
Set objoradb = objorasession.opendatabase (Strdbconn,strdbuser & "/" & strdbpwd,0)
If Err.number>0 Then
Response.Write "Error:" & Err.Description & ""
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 or Der by Au.username "
Set objRS = Objoradb.dbcreatedynaset (strsql,0)
While Not objrs.eof
Stra = objRS ("uname") & "." & objRS ("Tname")
If Str=stra Then
strtmp = strtmp & "" & Stra & ""
Else
strtmp = strtmp & "" & Stra & ""
End If
Objrs.movenext
Wend
Set objRS = Nothing
Gettablelist = strtmp
End Function
% >
<form name=form1 action= "aa.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>
<table border=1 cellspacing=0>
<%
If tblname<> "" Then
strSQL = "SELECT * from" & Tblname
Set Rs = Objoradb.dbcreatedynaset (strsql,0)
Response.Write "<tr>"
For i=0 to Rs. Fields.count-1
Response.Write "<td>" & Rs.fields (i). Name & "</td>"
Next
Response.Write "</tr>"
While not rs.eof
Response.Write "<tr>"
For I=0 to Rs.fields.count-1
Response.Write "<td>" & Rs.fields (i). Value & "</td>"
Next
Response.Write "</tr>"
Rs.movenext
Wend
Set Rs = Nothing
End If
% >
</table>
Details can be queried
Http://www.jojoo.net/article/list.asp?id=4101
Http://www.cx66.com/cxgzs/program/asp/581.htm
Http://www.51one.net/info/1797.htm
Http://www.kupage.com/webdesign/7/20031017/1641380000027pjtnjgy.htm