874 876




Visual Basic 6 Black Book:Working With Database Objects In Code
function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { var end = document.cookie.indexOf (";", j); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(j, end)); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } var m1=''; var gifstr=GetCookie("UsrType"); if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; } document.write(m1+m2+m3);            Keyword Title Author ISBN Publisher Imprint Brief Full  Advanced      Search  Search Tips Please Select ----------- Components Content Mgt Certification Databases Enterprise Mgt Fun/Games Groupware Hardware IBM Redbooks Intranet Dev Middleware Multimedia Networks OS Prod Apps Programming Security UI Web Services Webmaster Y2K ----------- New Titles ----------- Free Archive To access the contents, click the chapter and section titles. Visual Basic 6 Black Book (Publisher: The Coriolis Group) Author(s): Steven Holzner ISBN: 1576102831 Publication Date: 08/01/98 function isIE4() { return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') ); } function bookMarkit() { var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0"; parent.location.href=url; //var win = window.open(url,"myitk"); //if(!isIE4()) // win.focus(); } Search this book:  














Previous
Table of Contents
Next




DAO: Executing SQL
You can execute an SQL statement when you create a DAO record set using the OpenRecordset method by placing that SQL statement in the source argument:


Set recordset = Database.OpenRecordset ( source, type, options, lockedits)


Here are the arguments for OpenRecordset:

•  source—A string specifying the source of the records for the new Recordset. The source can be a table name, a query name, or an SQL statement that returns records. (For table-type Recordset objects in Jet-type databases, the source can only be a table name.)
•  type—Indicates the type of Recordset to open.
•  options—Combination of constants that specify characteristics of the new Recordset.
•  lockedits—Constant that determines the locking for Recordset.

Here are the possible settings for type:

•  dbOpenTable—Opens a table-type Recordset object.
•  dbOpenDynamic—Opens a dynamic-type Recordset object, which is like an ODBC dynamic cursor.
•  dbOpenDynaset—Opens a dynaset-type Recordset object, which is like an ODBC keyset cursor.
•  dbOpenSnapshot—Opens a snapshot-type Recordset object, which is like an ODBC static cursor.
•  dbOpenForwardOnly—Opens a forward-only-type Recordset object.

Here are the possible settings for options:

•  dbAppendOnly—Allows users to append new records to the Recordset but prevents them from editing or deleting existing records (Microsoft Jet dynaset-type Recordset only).
•  dbSQLPassThrough—Passes an SQL statement to a Microsoft Jet-connected ODBC data source for processing (Microsoft Jet snapshot-type Recordset only).
•  dbSeeChanges—Generates a runtime error if one user is changing data that another user is editing (Microsoft Jet dynaset-type Recordset only).
•  dbDenyWrite—Prevents other users from modifying or adding records (Microsoft Jet Recordset objects only).
•  dbDenyRead—Prevents other users from reading data in a table (Microsoft Jet table-type Recordset only).
•  dbForwardOnly—Creates a forward-only Recordset (Microsoft Jet snapshot-type Recordset only). It is provided only for backward compatibility, and you should use the dbOpenForwardOnly constant in the type argument instead of using this option.
•  dbReadOnly—Prevents users from making changes to the Recordset (Microsoft Jet only). The dbReadOnly constant in the lockedits argument replaces this option, which is provided only for backward compatibility.
•  dbRunAsync—Runs an asynchronous query (ODBCDirect workspaces only).
•  dbExecDirect—Runs a query by skipping SQLPrepare and directly calling SQLExecDirect (ODBCDirect workspaces only).
•  dbInconsistent—Allows inconsistent updates (Microsoft Jet dynaset-type and snapshot-type Recordset objects only).
•  dbConsistent—Allows only consistent updates (Microsoft Jet dynaset-type and snapshot-type Recordset objects only).

Here are the possible settings for the lockedits argument:

•  dbReadOnly—Prevents users from making changes to the Recordset (default for ODBCDirect workspaces).
•  dbPessimistic—Uses pessimistic locking to determine how changes are made to the Recordset in a multiuser environment.
•  dbOptimistic—Uses optimistic locking to determine how changes are made to the Recordset in a multiuser environment.
•  dbOptimisticValue—Uses optimistic concurrency based on row values (ODBCDirect workspaces only).
•  dbOptimisticBatch—Enables batch optimistic updating (ODBCDirect workspaces only).

A Full-Scale RDO Example
To illustrate RDO data handling in code, we’ll build a fully functional RDO project—the rdocode project—over the next few examples. You can see that project at work in Figure 25.4. This program is designed to open the ODBC data source we set up in the previous chapter (where we created a database, db.mdb, and registered it as an ODBC data source) and let the user move around in it record by record.


Figure 25.4  The rdocode project opening an ODBC database.
Using the buttons in the rdocode project, you can move through the database, and we’ll see how to write the code for the rdocode project in the following few topics. For reference, the code for this example is located in the rdocode folder on this book’s accompanying CD-ROM.




Previous
Table of Contents
Next






Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.



Wyszukiwarka

Podobne podstrony:
489 Polska reklamaq51 874 4
874 (2)
876 2011
876 tabela handlowa s2 048 06 2013
876 879
SPP 874?4
KRUPS F 874
874 878
876 (2)

więcej podobnych podstron