What is ActiveX?

ActiveX is an extention of the OLE and COM technologies that were developed for Windows 3.1. To understand ActiveX, you must understand how it evolved from these earlier technologies. Microsoft developed OLE to simplify the process by which Windows programs could exchange information. OLE was developed to allow objects that were developed in one program to be displayed and edited in other. An object embedded, referred to as the OLE container, and the program that creates the embedded object, referred to as the OLE server.

Microsoft portrayed ActiveX as a new technology, but it is essentially COM(Component Object Model) for the Internet. Since its introduction, ActiveX has been expanded to include a variety of related technologies. Some of these technologies are as follows.

ActiveX Components: COM components that can be used in Internet applications. ActiveX components that are GUI controls are referred to as ActiveX controls.
ActiveX Scripting: The use of JScript, VBScript, and other scripting languages to integrate ActiveX controls in Web applications.
Active Server Pages(ASP): The extension of ActiveX Components to Web servers.
ActiveX Data Objects(ADO): Provide the capability to access database through the use of COM and OLE.
Active Documents: An extension of OLE to allow documents to be more accessible within an ActiveX container, such as Internet Explorer.
ActiveX Conferencing: ActiveX technologies, such as NetMeeting, that support conferencing over the Internet.

ADO Overview

Microsoft ActiveX Data Objects (ADO) enable your client applications to access and manipulate data in a database server through any OLE DB provider. The primary benefits of ADO are ease of use, high speed, low memory overhead, and a small disk footprint. Those of you familiar with Data Access Objects (DAO) and Remote Data Objects (RDO) should find the programming model for ADO familiar.

You can use ADO on any operating system that supports COM and OLE automation (i.e.: 32-bit Windows environments). ADO is also language neutral: you can use it from C++, Java, Visual Basic, or any other language that supports COM and OLE automation. If you are going to use ADO, get familiar with the most commonly used ADO interfaces:

  • Connection: Provides a connection to a data source. By using the Execute method, you can run any king of command.
  • Error: Provides the means to return an error from a data source.
  • Command: Provides a method for sending a command that a data source can process. A command can be a simple SQL statement or calls to stored procedures in a database.
  • Parameter: Provides the ability to pass a parameter of a command.
  • Recordset: Provides cursor functionality.
  • Field: Provides a column in a Recordset that can be then used to retrieve or modify values in a column.
DSNless (Data Source Name) Microsoft Access Database Connections
<%

'Declare variables
 Dim strConn	'Holds the Database driver, path and name of the Database
 Dim objConn 	'Database Connection Object Variable
 Dim strSQL	'Holds the SQL query for the Database
 Dim rsUser	'Database recordset
 
 'Database connection string info and driver 
 strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("DB.mdb")
 
 'Create a connection object
 Set objConn = Server.CreateObject("ADODB.CONNECTION")
 
 'Set an active connection to the Connection object
 objConn.Open strConn

'Intialise the ADO recordset object
 Set rsUser = Server.CreateObject("ADODB.RECORDSET")
	
'Initalise the strSQL variable with an SQL statement to query the database
 strSQL = "SELECT tblUser.* FROM tblUser"
	
'ADO cursor functionality
 rsUser.CursorLocation = Application("adUseClient")
 rsUser.CursorType = Application("adOpenForwardOnly")
 rsUser.LockType = Application("adLockReadOnly")
	
'Query the database
 rsUser.Open strSQL, strConn

%>
Recordset Object Properties (CursorLocation, CursorType & LockType)
<%

'---- CursorLocationEnum Values ----
Application("adUseNone") = 1            'Does not use cursor services
Application("adUseServer") = 2          'Default. Uses data-provider or driver-supplied cursors
Application("adUseClient") = 3          'Uses client-side cursors supplied by local cursor library

'---- CursorTypeEnum Values ----
Application("adOpenForwardOnly") = 0     'Default. Uses a forward-only cursor
Application("adOpenKeyset") = 1          'Does allow to use the PageCount or RecordCount
Application("adOpenDynamic") = 2         'Uses a dynamic cursor
Application("adOpenStatic") = 3          'Additions or deletions by other users are not visible
Application("adOpenUnspecified") = -1    'Does not specify the type of cursor

'---- LockTypeEnum Values ----
Application("adLockReadOnly") = 1        'Does not allow to alter any data at all
Application("adLockPessimistic") = 2     'Locks records at the data source immediately upon editing
Application("adLockOptimistic") = 3	     'only locks records when you call the Update method
Application("adLockBatchOptimistic") = 4 'Required for batch update mode
Application("adLockUnspecified") = -1    'Does not specify a type of lock

%>
 
Copyright © 2002 by EzSofTech. All Rights Reserved.