Example of connecting Oracle databases via OO4O in ASP

Source: Internet
Author: User

&NBSP The code below can show that all users and tables that the current user can see are interested in adding the contents of each table to the

<%
Dim objorasession,objoradb
Dim Strdbuser,strdbpwd,strdbconn
Call Connectdb ()
Sub connectdb ()
  ' Connect 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 " error:" & Err.Description & " br>   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 a S uname from All_tables at,all_users au Where au.username=at.owner order by Au.username "
  Set objRS = OBJORADB.D Bcreatedynaset (strsql,0)
  while  not objrs.eof
   stra = objRS ("uname") & "." & objRS ("Tname")
   If Str=stra then
    strtmp = strtmp &

"
   Else"
    strtmp = strtmp & " "
   End If
   objrs.movenext
  Wend  
 set objRS = Nothing
 gettablelist = strtmp
End Function
%>

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.