Tutorials to .com

Tutorials to .com » Asp » Database » In ASP using Oracle Object for OLE visit Oracle 8

In ASP using Oracle Object for OLE visit Oracle 8

Print View , by: iSee ,Total views: 11 ,Word Count: 1973 ,Date: Mon, 25 May 2009 Time: 3:41 PM

asp (Active Server Pages) is Microsoft for the development of Internet applications made by one of the tools, it is a similar to HTML (Hypertext
Markup Language HTML), Script and CGI (Common Gateway interface Common Gateway Interface) combination, but their efficiency is
Higher than CGI, programming easier than HTML and more flexibility, security procedures and confidentiality Script than good. So ASP is currently the web development technology
The most easy to learn, flexibility, the largest development tools.
ASP built-in ADO component is the development of the Internet, Microsoft access database solution, ASP is also an important hero to access the database, ADO through ODBC access to a number of
According to the Treasury, from the ADO theory can be supported by access to a variety of ODBC databases, such as Microsoft SQL Server, Access, Foxpro, Oracle, Dbase, etc.
However, in practice we found that ADO can fully support the Microsoft SQL Server and Acess, however, on some difficult Oracle, the author Lee in practice
ADO visit with Oracle8, not be able to access ADO found that the number of Oracle8 type field, ADO and found the speed very slow access to Oracle8.
In order to address access to Oracle8 using the speed of ASP and other technical problems, I tried using the oracle Object for OLE visit Oracle8, results from
I got the expected results.
Oracle Object for OLE is the Oracle client in order to access the database by the development of an important product, it Windows95/98/NT based on a total of
All with the OLE-compatible applications to access Oracle database. It is not the user interface of OLE Server, it includes Oracle Objects Server is the ASP
Visit the Oracle database, one of the important hero.
Through Oracle Objects Server to access the Oracle8 database, in addition to basic Web server and ASP software, but also must determine the Web server has an
Installed Oracle Object for OLE software, the software they need, including: Network Protocol Adapter, Oracle Object for OLE2.X,
SQL * Net Client2.X or Oracle Net8 Client8.X, SQL * Plus, and Oracle8 ODBC Driver. In determining the above-mentioned Web server software has been installed,
Also must use SQL * Net Client2.X or Oracle Net8 Client8.X testing database connections and set up a database alias (Database Alias).
Oracle Objects Server, providing a total of Oraclient, Orasession, Oraconnection, OraDatabase, OraDynaset, OraSQLstmt,
OraField, Oraparameter, Oraparameter Array nine for developers to use objects. Its function and role are as follows:
1. Oraclient object
Oraclient is used to define server-side (Client or Workstation) the scope, Oraclient will record all the server-side object Orasession.
Oraclient by the system automatically created as needed.
2. Orasession object
Orasession object used in the procedure management Oraconnection, OraDatabase, OraDynaset and other objects, its establishment is as follows:
Set Orasession = Create ( "OracleInProcServer.Xorasession")
3. Oraconnection object
OraDatabase object expressed Oraconnection object linking, when the need to establish OraDatabase object, the system will automatically generate a Oraconnection
Object. In contrast, when the database when disconnected, Oraconnection automatically release objects.
4. OraDatabase object
OraDatabase object that the database server to a virtual registry, the registry as follows:
Set Oradadabase = Orasession.Dbopendatabase_
( "Database alias", "user name / password", 0)
5. OraDynaset object
OraDynaset object database server will be in line with the SELECT command to the data stored in the client buffer, allows users to browse or update, and finally write the results
Back to the server, the method is as follows:
SetOraDynaset = OraDatabase.DbcreateDynaset ( "SQL statement", 0)
6. OraSQLstmt object
OraSQLstmt object is usually used to run the SQL command or stored procedure call, and its usage is as follows:
Set Orasqlstmt = Oradatabase.createSQl ( "SQL statement", 0)
7. OraField object
OraField object OraDynaset object in a field or data item, he or through the Value property of the object OraDynaset made a field
Value.
8. Oraparameter object
Oraparameter object that a SQL command or PL / SQL program block attached to the variables.
9. Oraparameter Array object
Oraparameter Array is the array type Oraparameter object, Oraparameter Array object can be targeted indirectly through OraDatabase
Oraparameter data set to increase, access to or remove a variable.

Give a specific example below explains how to use ASP in Oracle Object for OLE visit to Oracle 8.
I prepared an ASP in the Oracle Object for OLE2.3 using Oracle 8.0.5 database query and page display process. As a result of
Orasession object's properties page in no control of the property, should be the author of the page self-control procedures.
The following were the two ASP files (query.asp and query1.asp), query.asp file first obtain the contents of database tables, and then calculating the page number of pages, if the number of pages super
Off page query1.asp referred to treatment, their program code is as follows
'query.asp
<%
'Connect to database
set orasession = createobject ( "oracleinprocserver.xorasession")
set oradatabase = orasession.dbopendatabase ( "orant", "scotter / tiger", 0)
'Set the query
sql = "select * from cq_hjwj"
set session (oradynaset) = oradatabase.dbcreatedynaset (sql, 0)
'Settings page
pagesize = 15
if session (oradynaset). recordcount = 0 then
response.write "No data in line with the conditions"
else
response.write "<h3> query results </ h3>"
'Calculation of the number of pages
pages = int (session (oradynaset) .recordcount / pagesize)
if pages * pagesize = session (oradynaset). recordcount then
pages = int (session (oradynaset) .recordcount / pagesize)
else
pages = int (session (oradynaset) .recordcount / pagesize) +1
end if
if request ( "page ")="" then
page = 1
else
page = cstr (request ( "page"))
end if
response.write "total" & pages & "page, at present the first" & page & "page"
response.write "<table border=5> <tr>"
for i = 0 to session (oradynaset). fields.count - 1
response.write "<td>"
response.write session (oradynaset). fields (i). name
response.write "</ td>"
next
response.write "</ tr>"
startrow = (page-1) * pagesize +1
endrow = page * pagesize
oradynaset.moveto startrow
for j = startrow to endrow
response.write "<tr>"
for i = 0 to session (oradynaset). fields.count - 1
response.write "<td>"
response.write session (oradynaset). fields (i). value
response.write "</ td>"
next
response.write "</ tr>"
session (oradynaset). dbmovenext
if session (oradynaset). eof then exit for
next
response.write "</ table>"
end if
if page> 1 then
response.write "<a href='query1.asp?page=1'> the first page </ a>"
response.write "<a href='query1.asp?page=" & page-1 & "'> Previous </ a>"
end if
if cint (page) <pages then
response.write "<a href='query1.asp?page=" & page+1 & "'> Next </ a>"
response.write "<a href='query1.asp?page=" & pages & "'> the last page </ a>"
end if
set orasession = nothing
%>
<html>
</ html>

'query1.asp
<%
'Settings page
pagesize = 15
if session(oradynaset).recordcount=0 then
response.write "No data in line with the conditions"
else
response.write "<h3> query results </ h3>"
'Calculation of the number of pages
pages = int (session (oradynaset) .recordcount / pagesize)
if pages * pagesize = session (oradynaset). recordcount then
pages = int (session (oradynaset) .recordcount / pagesize)
else
pages = int (session (oradynaset) .recordcount / pagesize) +1
end if
if request ( "page ")="" then
page = 1
else
page = cstr (request ( "page"))
end if
response.write "total" & pages & "page, at present the first" & page & "page"

response.write "<table border=5> <tr>"
for i = 0 to session (oradynaset). fields.count - 1
response.write "<td>"
response.write session (oradynaset). fields (i). name
response.write "</ td>"
next
response.write "</ tr>"
startrow = (page-1) * pagesize +1
endrow = page * pagesize
oradynaset.moveto startrow
for j = startrow to endrow
response.write "<tr>"
for i = 0 to session (oradynaset). fields.count - 1
response.write "<td>"
response.write session (oradynaset). fields (i). value
response.write "</ td>"
next
response.write "</ tr>"
session (oradynaset). dbmovenext
if session (oradynaset). eof then exit for
next
response.write "</ table>"
end if
if page> 1 then
response.write "<a href='query1.asp?page=1'> the first page </ a>"
response.write "<a href='query1.asp?page=" & page-1 & "'> Previous </ a>"
end if
if cint (page) <pages then
response.write "<a href='query1.asp?page=" & page+1 & "'> Next </ a>"
response.write "<a href='query1.asp?page=" & pages & "'> the last page </ a>"
end if
set orasession = nothing
%>
<html>
</ html>
The above procedure on the Windows Nt4.0 + Iss4.0 by running.
ORACLE database as a result of a wide range of applications, the market has been sold prior to account for a few, many corporate MIS, IT systems to ORACLE database as the basis for data storage,
ORACLE database information will be added to web pages, you can greatly enrich the web publishing of information, so that we can publish web pages in real time, the complexity of the database information,
The client can receive the database information changes. Therefore the use of this method can improve access to the Web on the efficiency of ORACLE.


ASP Database Related Articles


Can't Find What You're Looking For?


Rating: 0.0

Comments

No comments posted.