2025-04-27 07:49:33 -04:00

85 lines
4.5 KiB
HTML
Raw Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>Database Access Component</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</script>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1><A NAME="_database_access_component"></A><SUP></SUP>Database Access Component</H1>
<P>The Database Access Components (DAC) provide access to information stored in databases or other tabular data structures.&nbsp; DAC includes ActiveX<sup>&reg;</sup> Data Objects (ADO), Open Database Connectivity (ODBC), and Object Linking and Embedding for Databases (OLEDB). ASP can use these components to easily integrate information from a variety of database sources, like Microsoft<66> Access, SQL, Excel and other technologies. Providing access to multiple types of data storage is called Universal Data Access.</P>
<P>For information about developing applications that use Universal Data Access see <a HREF="http://www.microsoft.com/isapi/redir.dll?prd=mdac" target=_blank><b><span class=le>Universal Data Access Web Site</span></b></a> or the Microsoft Data Access SDK in the Platform SDK.</P>
<P>ADO is the most commonly used Data Access Component because of its ease of use. ADO has a library of seven objects with methods and properties to help you access data. Each object can be created using Server.CreateObject:</P>
<PRE><CODE>&lt;%
' Create two of the seven ADO objects.
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
%&gt;</CODE></PRE>
<P><span class=le><B>Note</B></span></P>
<P>ADO uses a lot of constants that are pre-defined in a type library to keep the user from having to remember specific values. To use the constants specified in the ADO Reference, you must either include a file that contains information about the ADO constants, or include a reference to the ADO type library in your Global.asa file. The following example demonstrates using the ADO type library to access constants.</P>
<P>For example, to use this line in an ASP file, you would have to remember that 3 indicates Open Static and Lock Optimistic:</P>
<PRE><CODE>&lt;% rs.Open "Customers", Conn, 3, 3 %&gt;
</CODE></PRE>
<P>If you include the type library for ADO, you could use this code:</P>
<PRE><CODE>&lt;% rs.Open "Customers", Conn, adOpenStatic, adLockOptimistic %&gt;
</CODE></PRE>
<P>To include the following type library in your application, put this declaration in the Global.asa file.</P>
<PRE><CODE>&lt;!-- METADATA TYPE="typelib" FILE="c:\program files\common files\system\ado\msado20.dll"--&gt;
</CODE></PRE>
<P>For more information about type libraries and constants, see <A HREF="iiwavar.htm">Using Variables and Constants</A>. For more information about data access, see <A HREF="iiwadata.htm">Accessing a Data Source</A> and <A HREF="/iishelp/iis/htm/asp/eadg3l80.htm">Accessing Data with ASP</A>.</P>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>