Microsoft KB Archive/193225

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:43, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


Article ID: 193225

Article Last Modified on 12/3/2007



APPLIES TO

  • Microsoft Active Server Pages 4.0
  • Microsoft Internet Information Services 6.0
  • Microsoft Data Access Components 2.8



This article was previously published under Q193225

INTRODUCTION

This article discusses how to connect to an Oracle database by using a Microsoft Active Server Pages (ASP) page and Microsoft ActiveX Data Objects (ADO).

MORE INFORMATION

To connect to an Oracle database, you can create an ASP page that contains the following code.

Note Make sure that the connect string has a valid user ID and password and that the SQL statement references a valid table.

   <%@ Language=VBScript %>
   <html>
   <head>
   <title>Oracle Test</title>
   </head>
   <body>
   <center>
   <%
     Set objConn = Server.CreateObject("ADODB.Connection")
     objConn.Open "Provider=MSDAORA;Data Source=<Your_TNSNames_Alias>;User Id=<userid>;Password=<password>;"

     Set objRs = objConn.Execute("SELECT * FROM DEMO.EMPLOYEE")

     Response.Write "<table border=1 cellpadding=4>"
     Response.Write "<tr>"

     For I = 0 To objRS.Fields.Count - 1
       Response.Write "<td><b>" & objRS(I).Name & "</b></td>"
     Next

     Response.Write "</tr>"

     Do While Not objRS.EOF
       Response.Write "<tr>"

       For I = 0 To objRS.Fields.Count - 1
         Response.Write "<td>" & objRS(I) & "</td>"
       Next

       Response.Write "</tr>"

       objRS.MoveNext
     Loop

     Response.Write "</table>"

     objRs.Close
     objConn.Close
   %>
   </center>
   </body>
   </html>
                

REFERENCES

For more information about how to connect to an Oracle database, click the following article number to view the article in the Microsoft Knowledge Base:

178391 Oracle TNS: Authentication service initialization error


For more information about the Microsoft ODBC Driver for Oracle and the Microsoft OLE DB Provider for Oracle, click the following article number to view the article in the Microsoft Knowledge Base:

244661 Limitations of Microsoft Oracle ODBC Driver and OLEDB Provider


For more information about how to contact Oracle, click the following article number to view the article in the Microsoft Knowledge Base:

60781 Hardware and software vendor contact information, L-P


Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.


Additional query words: kbDSupport

Keywords: kbhowto kboracle kbdatabase KB193225