Oracle| News | data | database | Web
The following code can show that the current user can see all the users and tables that are interested and can put the contents of each table.
<%
Dim objorasession,objoradb
Dim Strdbuser,strdbpwd,strdbconn
call Connectdb ()
Sub connectdb ()
' Connection Database
on Error Resume Next
strdbuser = "Tmpuser" Connection username
strdbpwd = "rt45ps1w" User password
strdbconn = "sun450" Connection string
Set objorasession = Server.CreateObject ("oracleinprocserver.xorasession")
Set objoradb = objorasession.opendatabase (Strdbconn,strdbuser & "/" & strdbpwd,0)
If Err.number>0 then
Response.Write "<font color=red> Error:" & 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.o Wner 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 & "/" & Str Dbpwd & "@" & strdbconn%>) </font>
</td></tr>
</table>
</form>