Using Oracleinprocserver to complete the connection and operation of Oracle under ASP ____oracle

Source: Internet
Author: User
<% 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.