1. Trang chủ
  2. » Công Nghệ Thông Tin

Wrox VBScript programmers reference dec 1999 ISBN 0764543679 pdf

618 159 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 618
Dung lượng 3,34 MB

Nội dung

Table of Contents VBScript Programmer's Reference Introduction .6 Who is this Book For? How to Use this Book What is VBScript? What Can You Do With VBScript? 11 What Tools Do You Need to Use VBScript? .14 What's New in VBScript 5? 15 Code Conventions .17 Tell Us What You Think .17 Customer Support .18 Chapter 1: A (Very) Short Introduction to Programming 19 Overview .19 Variables and Data Types 19 Control of Flow 23 Operators .31 Organizing and Reusing Code 32 Top−Down vs Event Driven 35 Some Guidelines to Keep in Mind 37 Suggestions for Further Reading 39 Chapter 2: Variables and Data Types 40 The Visual Basic Data Types 40 The Variant: VBScript's Only Data Type 42 Variables in VBScript 60 Literals and Named Constants 65 Complex Data Types 69 Chapter 3: Control of Flow 77 Branching Constructs 77 Loop Constructs 81 Chapter 4: Error Handling, Prevention and Debugging 93 Overview .93 Introduction 93 Seeing the Error of your Ways 94 Different Types of Errors 98 What Can We Do About Errors? 105 Debugging 120 Common Errors and How To Avoid Them 127 Summary 128 Chapter 5: Using COM Components and Objects 129 Overview 129 Introduction to COM components and Objects 129 Object and Object Interfaces .131 What COM Components and Objects are Available? 137 Objects and the Variant data type .138 i Table of Contents Chapter 5: Using COM Components and Objects Properties and Methods .139 Object Scope, Lifetime and References 141 Using the With Statement with Objects 145 Create your own COM Objects 146 Summary 146 Chapter 6: Using COM Components with MTS .147 Overview 147 A Quick Introduction to MTS 147 Advantages of using MTS 149 Next Step: COM+ .158 Summary 160 Chapter 7: The Built−In and Scripting Runtime Objects 162 Overview 162 Runtime vs Built−In − What's the Difference? 162 Built−In Objects 162 Regular Expressions 163 Scripting Runtime Objects 173 Summary 182 Chapter 8: Classes in VBScript (Writing Your Own COM Objects) .183 Classes vs Objects vs Components 183 Chapter 9: Windows Script Components 204 What Are Windows Script Components? 204 What Tools Do You Need? .204 The Script Component Runtime .205 Script Component Files 206 Exposing Properties, Methods, and Events .211 Creating Registration Information 214 Creating the Script Component Type Library 216 Interface Handlers .218 Compile−time Error Checking 220 Using VBScript Classes in Script Components 220 Summary 227 Chapter 10: The Windows Script Host 228 Overview 228 What Tools Do You Need? .228 What is the Windows Script Host? 229 Running Scripts with Windows Script Host .230 Using WSH Files to Launch Scripts 232 Windows Script Host Intrinsic Objects .232 Summary 263 Additional Resources 263 ii Table of Contents Chapter 11: General Client−Side Web Scripting .265 What Tools Do You Need? .265 How Browser Scripting Works 265 The Various Scripting Languages − What's Best for the Browser 266 Responding to Browser Events 268 Validating Forms 272 The Document Object Model 276 Summary 280 Chapter 12: High−Powered Client Scripting 282 Technology Requirements 282 Importance of Browser Security Settings 282 Scriptlets − Ancestors of Behaviors 282 Managing Events 288 Behaviors 292 HTML Components 295 Remote Scripting 304 Summary 310 Chapter 13: HTML Applications (HTAs) 311 What Tools Do You Need? .311 What is an HTML Application? .311 How to Create a Basic HTA .312 The Tag 314 HTAs and Security 320 HTA Deployment Models 324 What Isn't Supported With HTAs? 326 Summary 327 Chapter 14: Server−Side Web Scripting With ASP 328 Overview 328 The Anatomy of the HTTP Protocol 328 Introducing Active Server Pages 333 The Active Server Pages Object Model 336 Using Active Server Pages Effectively .352 Summary 358 Chapter 15: Talking to Databases: ActiveX Data Objects .359 What Tools Do You Need? .359 The Evolution of ADO 359 What Are ActiveX Data Objects? .360 The ADO Objects .361 Summary 374 Chapter 16: Microsoft Script Control 375 Why Script your Application? 375 What tools you need? 376 Adding Script Control to VB Application 377 Macro and Scripting Concepts 380 The Script Control Object Model .381 iii Table of Contents Chapter 16: Microsoft Script Control Other Scripting Elements 396 Error Trapping with Script Control 397 Sample Applications 399 Summary 408 Appendix A: Visual Basic Functions and Keywords 409 Overview 409 Operators 409 Math Functions 417 Date and Time Functions and Statements 422 Unsupported Array Functions and Statements 435 Unsupported String Functions, Statements and Constructs 449 String Constants 451 Conversion Functions .451 Unsupported conversion functions 456 Miscellaneous Functions, Statements and Keywords .457 Appendix B: Differences between VB/VBA and VBScript5 471 Appendix C: Code Conventions 474 Variable Naming Conventions 474 Procedure Naming 475 Indentation 475 Commenting 476 Appendix D: Visual Basic Constants Supported in VBScript 477 Color Constants 477 Date and Time Constants 477 Date Format Constants 478 Miscellaneous Constants 478 MsgBox Constants 478 String Constants 479 Tristate Constants .479 VarType Constants 479 Appendix E: VBScript Error Codes and the Err Object 481 Runtime Errors 481 Syntax Errors 482 Err Object and On Err statement .484 Appendix F: The Scripting Runtime Library Objects Reference 494 The Scripting.Dictionary Object .494 The Scripting.FileSystemObject Object 495 The Scripting.TextStream Object .500 Appendix G: Windows Script Host 2.0 502 iv Table of Contents Appendix H: The Browser Object Model IE4 514 The Object Model In Outline 514 HTML and Form Controls Cross Reference .530 Appendix I: The Browser Object Model IE5 533 The Object Model In Outline 533 HTML and Form Controls Cross Reference .545 Appendix J: The Integral ASP Objects .548 The ASP Object Model .548 The Application Object .549 The ASPError Object 550 The Request Object 550 The Response Object 551 The Server Object .553 The Session Object 554 Appendix K: ADO Object Summary, Constants, and Data Types 557 Microsoft ActiveX Data Objects 2.5 Library Reference 557 ADO Constants 571 ADO Data Types .605 Appendix L: The Microsoft Script Encoder 611 v VBScript Programmer's Reference Susanne Clark, Antonio De Donatis, Adrian Kingsley−Hughes, Kathie Kingsley−Hughes, Brian Matsik, Erick Nelson, Piotr Prussak Daniel Read, Carsten Thomsen, Stuart Updegrave, Paul Wilton Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2003 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada Library of Congress Card Number: ISBN: 0−7645−4367−9 Manufactured in the United States of America 10 1B/QZ/QW/QT/1N No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per−copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750−8400, fax (978) 646−8700 Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572−3447, fax (317) 572−4447, E−Mail: permcoordinator@wiley.com Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose No warranty may be created or extended by sales representatives or written sales materials The advice and strategies contained herein may not be suitable for your situation You should consult with a professional where appropriate Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages VBScript Programmer's Reference For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S at (800) 762−2974, outside the U.S at (317) 572−3993 or fax (317) 572−4002 Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books Trademarks: Wiley, the Wiley Publishing logo, Wrox, the Wrox logo, the Wrox Programmer to Programmer logo and related trade dress are trademarks or registered trademarks of Wiley in the United States and other countries, and may not be used without written permission All other trademarks are the property of their respective owners Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book Trademark Acknowledgements Wrox has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals However, Wrox cannot guarantee the accuracy of this information Credits Authors Daniel Read Susanne Clark Antonio De Donatis Adrian Kingsley−Hughes Kathie Kingsley−Hughes Brian Matsik Erick Nelson Piotr Prussak Carsten Thomsen Stuart Updegrave Paul Wilton Technical Reviewers Chris Behrens Steve Danielson John Granade Michael Harris Richard Harrison Dan Pfeffer Nic Roche Design / Layout Tom Bartlett Mark Burdett William Fallon Jonathan Jones John McNulty VBScript Programmer's Reference Additional Material Jerry Ablan Jeff Hart Alex Homer David Sussman Chris Ullman Illustrations William Fallon Jonathan Jones Editors Gregory Beekman Lums Thevathasan Robert Shaw Devin Lunsford Cover Design Chris Morris Project Manager Chandima Nethisinghe Managing Editor Victoria Hudgson Index Martin Brooks Development Editor Peter Morgan About the Authors Daniel Read Daniel Read is Senior Developer at Compass, Inc in Atlanta, GA, where he and fellow team members build IIS/ASP/VB/MTS e−commerce web sites, as well as client/server and distributed systems Daniel sometimes longs for his simpler, statically linked days as an X−Base developer and DOS command line junkie, but today enjoys the power afforded by the arsenal of Microsoft's Windows DNA tools and technologies His other interests include camping, crime fiction, listening to music of all sorts, and going to as many concerts as he can He's not sure if co−authoring a programming book will help him meet the woman of his dreams, but it sure would be nice Carsten Thomsen Carsten Thomsen is a Microsoft Certified Systems Engineer, who started programming in Visual Basic back in 1993, when it was version 3.0 Presently he is pursuing Microsoft Certified Systems Developer certification and was recently awarded the MVP title for his contributions to the Microsoft Visual Basic newgroups For the last years he has been developing 2−tier and 3−tier client/server solutions based on MS SQL Server, MTS and MSMQ, but has more recently been moving towards browser−based development, based on MS IIS, VBScript Programmer's Reference using ASP/VBScript, COM/ActiveX components and Visual Basic WebClasses In whatever spare time he has, he enjoys traveling and spending time with his two daughters, Nicole and Caroline, and his girlfriend Mia He works out at a local gym and (at spectator−level) enjoys ice hockey and soccer He is generally considered a computer freak, and spends too much time at the computer Piotr Prussak Piotr Prussak works for ACEN in Buffalo, NY as a developer (although he is originally from Poland) He creates ASP, VB and Java Applications for the company and its clients He also spends some time working with the SQL server and ColdFusion, probably more than he should When he's not programming and mentoring, he either writes stuff, or edits stuff written by others Sometimes he sleeps, eats and relaxes like any other human being In a past life he used to be a photographer, but that was just too relaxing Piotr (or Peter, as some might call him) is married to lovely Joanne, who is an MIS student at a local University Sometimes they travel all over the world and are disconnected from the world of computers and 24 hour news Brian Matsik Brian Matsik is the President and Senior Consultant at OOCS in Charlotte, NC He is MCSD certified and has been working with Visual Basic, VBScript, and VBA for over six years He currently specializes in ASP, SQL Server, and VB COM Brian can be reached at brianmat@oocs.com Brian would like to thank Tracy for her support, Mike Dunner for keeping him on his toes when it comes to ADO and MTS, and Mark Harris for taking care of the books while he stays glued to the PC Paul Wilton After an initial start as a Visual Basic applications programmer, Paul found himself pulled into the net and has spent the last 18 months helping create internet and intranet solutions Currently he is developing web−based systems, primarily using Visual Basic and SQL Server 7, along with numerous other technologies Paul would like to wish lots of love to his fiancée Catherine, who ensures his sanity chip remains plugged in Antonio De Donatis Antonio De Donatis (adedonatis@yahoo.com) began programming in 1984, using a mixture of Basic and assembler on a Commodore 64 Since then, he has designed software the object−oriented way, employing more programming languages and technologies than he can count He finds programming to be one of the best activities to exercise creativity and to be intellectually active He has worked for many of the major firms in IT either as employee or as freelance His current interests include all the technologies involved in the design and implementation of e−commerce solutions Antonio holds a BS degree in Computer Science from Pisa University (Italy) and he is a Microsoft Certified Professional Susanne Clark Susanne has worked with the latest internet technologies, including DHTML, XML, XSL, IE5 programming and scripting, and has contributed chapters on these subjects to the recently published Professional Visual ADO Constants DBPROPVAL_PT_GUID_ NAME DBPROPVAL_PT_GUID_ PROPID DBPROPVAL_PT_NAME DBPROPVAL_PT_PGUID_ NAME DBPROPVAL_PT_PGUID_ PROPID DBPROPVAL_PT_PROPID DBPROPVAL_RD Name DBPROPVAL_RD_ RESETALL DBPROPVAL_RT The GUID Property ID is used as the persistent ID type 32 The NAME is used as the persistent ID type The Property GUID NAME is used as the persistent ID type The Property GUID Property ID is used as the persistent ID type The Property ID is used as the persistent ID type 64 16 Value −1 Description The provider should reset all states associated with the data source, with the exception that any open object is not released Name DBPROPVAL_RT_APTMTTHREAD DBPROPVAL_RT_FREETHREAD DBPROPVAL_RT_SINGLETHREAD DBPROPVAL_SQ Value Name DBPROPVAL_SQ_ COMPARISON DBPROPVAL_SQ_ CORRELATEDSUBQUERIES DBPROPVAL_SQ_ EXISTS DBPROPVAL_SQ_IN Value DBPROPVAL_SQ_ QUANTIFIED DBPROPVAL_SQL 16 Name DBPROPVAL_SQL_ANDI89_IEF DBPROPVAL_SQL_ANSI92_FULL Name DBPROPVAL_SQL_ANSI92_ INTERMEDIATE Description All predicates that support subqueries support comparison subqueries All predicates that support subqueries support correlated subqueries All predicates that support subqueries support EXISTS subqueries All predicates that support subqueries support IN subqueries All predicates that support subqueries support quantified subqueries Value DBPROPVAL_SQL_ANSI92_ENTRY Value 64 Description The DSO is apartment threaded The DSO is free threaded The DSO is single threaded Description The provider supports the ANSI SQL89 IEF level 16 The provider supports the ANSI SQL92 ENTRY level 128 The provider supports the ANSI SQL92 FULL level Description The provider supports the ANSI SQL92 INTERMEDIATE level 598 ADO Constants DBPROPVAL_SQL_CORE DBPROPVAL_SQL_ ESCAPECLAUSES DBPROPVAL_SQL_ EXTENDED DBPROPVAL_SQL_FIPS_ TRANSITIONAL DBPROPVAL_SQL_ MINIMUM DBPROPVAL_SQL_NONE DBPROPVAL_SQL_ODBC_ CORE DBPROPVAL_SQL_ODBC_ EXTENDED DBPROPVAL_SQL_ODBC_ MINIMUM DBPROPVAL_SQL_ SUBMINIMUM 256 32 512 The provider supports the ODBC 2.5 CORE SQL level The provider supports the ODBC ESCAPECLAUSES syntax The provider supports the ODBC 2.5 EXTENDED SQL level The provider supports the ANSI SQL92 TRANSITIONAL level The provider supports the ODBC 2.5 MINIMUM SQL level SQL is not supported The provider supports the ODBC 2.5 CORE SQL level The provider supports the ODBC 2.5 EXTENDED SQL level The provider supports the ODBC 2.5 MINIMUM SQL level The provider supports the DBGUID_SQL dialect and parses the command text according to SQL rules, but does not support wither the minimum ODBC level nor the ANSI SQL92 ENTRY level DBPROPVAL_SS Name DBPROPVAL_SS_ILOCKBYTES DBPROPVAL_SS_ ISEQUENTIALSTREAM DBPROPVAL_SS_ISTORAGE DBPROPVAL_SS_ISTREAM DBPROPVAL_SU Name DBPROPVAL_SU_DML_ STATEMENTS DBPROPVAL_SU_INDEX_ DEFINITION DBPROPVAL_SU_ PRIIVILEGE_DEFINITION DBPROPVAL_SU_TABLE_ DEFINITION DBPROPVAL_TC Name DBPROPVAL_TC_ALL Value Description The provider supports IlockBytes The provider supports IsequentialStream The provider supports Istorage The provider supports IStream Value Value Description Schema names are supported in all Data Manipulation Language statements Schema names are supported in all index definition statements Schema names are supported in all privilege definition statements Schema names are supported in all table definition statements Description Transactions can contain DDL and DML statements in any order 599 ADO Constants DBPROPVAL_TC_DDL_ COMMIT DBPROPVAL_TC_DDL_ IGNORE DBPROPVAL_TC_DDL_ LOCK DBPROPVAL_TC_DML DBPROPVAL_TC_NONE DBPROPVAL_TI Transactions can contain DML statements DDL statements within a transaction cause the transaction to be committed Transactions can only contain DML statements DDL statements within a transaction are ignored Transactions can contain both DML and table or index modifications, but the table or index will be locked until the transaction completes Transactions can only contain Data Manipulation (DML) statements DDL statements within a transaction cause an error Transactions are not supported 16 Name DBPROPVAL_TI_BROWSE Value 256 DBPROPVAL_TI_CHAOS 16 DBPROPVAL_TI_ CURSORSTABILITY DBPROPVAL_TI_ ISOLATED 4096 DBPROPVAL_TI_ READCOMMITTED DBPROPVAL_TI_ READUNCOMMITTED DBPROPVAL_TI_ REPEATABLEREAD DBPROPVAL_TI_ SERIALIZABLE 4096 1048576 256 65536 1048576 Description Changes made by other transactions are visible before they are committed Transactions cannot overwrite pending changes from more highly isolated transactions This is the default Changes made by other transactions are not visible until those transactions are committed All concurrent transactions will interact only in ways that produce the same effect as if each transaction were entirely executed one after the other Changes made by other transactions are not visible until those transactions are committed Changes made by other transactions are visible before they are committed Changes made by other transactions are not visible All concurrent transactions will interact only in ways that produce the same effect as if each transaction were entirely executed one after the other DBPROPVAL_TR Name DBPROPVAL_TR_ ABORT Value 16 DBPROPVAL_TR_ ABORT_DC DBPROPVAL_TR_ ABORT_NO DBPROPVAL_TR_ BOTH DBPROPVAL_TR_ 32 128 Description The transaction preserves its isolation context (i.e., it preserves its locks if that is how isolation is implemented) across the retaining abort The transaction may either preserve or dispose of isolation context across a retaining abort The transaction is explicitly not to preserve its isolation across a retaining abort Isolation is preserved across both a retaining commit and a retaining abort The transaction preserves its isolation context (i.e., it preserves its 600 ADO Constants COMMIT DBPROPVAL_TR_ COMMIT_DC DBPROPVAL_TR_ COMMIT_NO DBPROPVAL_TR_ DONTCARE DBPROPVAL_TR_ NONE DBPROPVAL_TR_ OPTIMISTIC DBPROPVAL_UP 64 256 512 Name DBPROPVAL_UP_CHANGE DBPROPVAL_UP_DELETE DBPROPVAL_UP_INSERT DBPROPVAL_BP Name DBPROPVAL_BP_ NOPARTIAL DBPROPVAL_BP_ PARTIAL JET_ENGINETYPE locks if that is how isolation is implemented) across the retaining commit The transaction may either preserve or dispose of isolation context across a retaining commit The transaction is explicitly not to preserve its isolation across a retaining commit The transaction may either preserve or dispose of isolation context across a retaining commit or abort This is the default Isolation is explicitly not to be retained across either a retaining commit or abort Optimistic concurrency control is to be used Value Description Indicates that SetData is supported Indicates that DeleteRows is supported Indicates that InsertRow is supported Value Description Fail the bulk operation if there is a single error Allow the bulk operation to partially complete, possibly resulting in inconsistent data Name JET_ENGINETYPE_UNKNOWN JET_ENGINETYPE_JET10 JET_ENGINETYPE_JET11 JET_ENGINETYPE_JET2X JET_ENGINETYPE_JET3X JET_ENGINETYPE_JET4X JET_ENGINETYPE_DBASE3 JET_ENGINETYPE_DBASE4 JET_ENGINETYPE_DBASE5 JET_ENGINETYPE_EXCEL30 JET_ENGINETYPE_EXCEL40 JET_ENGINETYPE_EXCEL50 JET_ENGINETYPE_EXCEL80 JET_ENGINETYPE_EXCEL90 JET_ENGINETYPE_EXCHANGE4 JET_ENGINETYPE_LOTUSWK1 Value 10 11 12 20 21 22 23 24 30 40 601 Description The database type is unknown Jet 1.0 Jet 1.1 Jet 2.x Jet 3.x Jet 4.x DBase III DBase IV DBase V Excel Excel Excel (Excel 95) Excel (Excel 97) Excel (Excel 2000) Exchange Server Lotus ADO Constants JET_ENGINETYPE_LOTUSWK3 JET_ENGINETYPE_LOTUSWK4 JET_ENGINETYPE_PARADOX3X JET_ENGINETYPE_PARADOX4X JET_ENGINETYPE_PARADOX5X JET_ENGINETYPE_PARADOX7X JET_ENGINETYPE_TEXT1X JET_ENGINETYPE_HTML1X MD_DIMTYPE 41 42 50 51 52 53 60 70 Name MD_DIMTYPE_MEASURE MD_DIMTYPE_OTHER Value MD_DIMTYPE_TIME MD_DIMTYPE_UNKNOWN SQL_FN_NUM Name SQL_FN_NUM_ABS SQL_FN_NUM_ACOS SQL_FN_NUM_ASIN SQL_FN_NUM_ATAN SQL_FN_NUM_ATAN2 SQL_FN_NUM_CEILING Value 16 32 SQL_FN_NUM_COS SQL_FN_NUM_COT SQL_FN_NUM_DEGREES 64 128 262144 SQL_FN_NUM_EXP SQL_FN_NUM_FLOOR SQL_FN_NUM_LOG SQL_FN_NUM_LOG10 SQL_FN_NUM_MOD SQL_FN_NUM_PI SQL_FN_NUM_POWER SQL_FN_NUM_RADIANS 256 512 1024 524288 2048 65536 1048576 2097152 SQL_FN_NUM_RAND SQL_FN_NUM_ROUND SQL_FN_NUM_SIGN SQL_FN_NUM_SIN 131072 4194304 4096 8192 Lotus Lotus Paradox 3.x Paradox 4.5 Paradox 5.x Paradox 7.x Text HTML Description A measure dimension The dimension is neither a time nor a measure dimension A time dimension The provider is unable to classify the dimension Description The ABS function is supported by the data source The ACOS function is supported by the data source The ASIN function is supported by the data source The ATAN function is supported by the data source The ATAN2 function is supported by the data source The CEILING function is supported by the data source The COS function is supported by the data source The COT function is supported by the data source The DEGREES function is supported by the data source The EXP function is supported by the data source The FLOOR function is supported by the data source The LOG function is supported by the data source The LOG10 function is supported by the data source The MOD function is supported by the data source The PI function is supported by the data source The POWER function is supported by the data source The RADIANS function is supported by the data source The RAND function is supported by the data source The ROUND function is supported by the data source The SIGN function is supported by the data source The SIN function is supported by the data source 602 ADO Constants SQL_FN_NUM_SQRT SQL_FN_NUM_TAN SQL_FN_NUM_TRUNCATE 10384 32768 8388608 The SQRT function is supported by the data source The TAN function is supported by the data source The TRUNCATE function is supported by the data source SQL_FN_STR Name SQL_FN_STR_ASCII Value 8192 SQL_FN_STR_BIT_LENGTH 524288 SQL_FN_STR_CHAR 16384 SQL_FN_STR_CHAR_LENGTH 1048576 SQL_FN_STR_CHARACTER_LENGTH 2097152 SQL_FN_STR_CONCAT SQL_FN_STR_DIFFERENCE 32768 SQL_FN_STR_INSERT SQL_FN_STR_LCASE 64 SQL_FN_STR_LEFT SQL_FN_STR_LENGTH 16 SQL_FN_STR_LOCATE 32 SQL_FN_STR_LOCATE_2 65536 SQL_FN_STR_LTRIM SQL_FN_STR_OCTET_LENGTH 4194304 SQL_FN_STR_POSITION 8388608 SQL_FN_STR_REPEAT 128 SQL_FN_STR_REPLACE 256 SQL_FN_STR_RIGHT 512 SQL_FN_STR_RTRIM 1024 603 Description The ASCII function is supported by the data source The BIT_LENGTH function is supported by the data source The CHAR function is supported by the data source The CHAR_LENGTH function is supported by the data source The CHARACTER_LENGTH function is supported by the data source The CONCAT function is supported by the data source The DIFFERENCE function is supported by the data source The INSERT function is supported by the data source The LCASE function is supported by the data source The LEFT function is supported by the data source The LENGTH function is supported by the data source The LOCATE function is supported by the data source The LOCATE_2 function is supported by the data source The LTRIM function is supported by the data source The OCTET_LENGTH function is supported by the data source The POSITION function is supported by the data source The REPEAT function is supported by the data source The REPLACE function is supported by the data source The RIGHT function is supported by the data source ADO Constants The RTRIM function is supported by the data source 131072 The SOUNDEX function is supported by the data source 262144 The SPACE function is supported by the data source 2048 The SUBSTRING function is supported by the data source 4096 The UCASE function is supported by the data source SQL_FN_STR_SOUNDEX SQL_FN_STR_SPACE SQL_FN_STR_SUBSTRING SQL_FN_STR_UCASE SQL_FN_SYS Name SQL_FN_SYS_DBNAME SQL_FN_SYS_IFNULL SQL_FN_SYS_USERNAME SQL_OJ Value Description The DBNAME system function is supported The IFNULL system function is supported The USERNAME system function is supported Name Value SQL_OJ_ALL_COMPARISON_OPS 64 SQL_OJ_FULL SQL_OJ_INNER 32 SQL_OJ_LEFT SQL_OJ_NESTED SQL_OJ_NOT_ORDERED 16 SQL_OJ_RIGHT SQL_SDF_CURRENT Name SQL_SDF_CURRENT_DATE SQL_SDF_CURRENT_TIME SQL_SDF_CURRENT_TIMESTAMP Description The comparison operator in the ON clause can be any of the ODBC comparison operators If this is not set, only the equals (=) comparison operator can be used in an outer join Full outer joins are supported The inner table (the right table in a left outer join or the left table in a right outer join) can also be used in an inner join This does not apply to full outer joins, which not have an inner table Left outer joins are supported Nested outer joins are supported The column names in the ON clause of the outer join not have to be in the same order as their respective table names in the OUTER JOIN clause Right outer joins are supported Value Description The CURRENT_DATE system function is supported The CURRENT_TIME system function is supported The CURRENT_TIMESTAMP system function is supported SSPROP_CONCUR Name SSPROP_CONCUR_ LOCK Value Description Use row locking to prevent concurrent access 604 ADO Constants SSPROP_CONCUR_ READ_ONLY SSPROP_CONCUR_ ROWVER The rowset is read−only Full concurrency is supported Use row versioning to determining concurrent access violations The SQL Table or tables must contain a timestamp column Use the values of the columns in the rowset row SSPROP_CONCUR_ VALUES SSPROPVAL_USEPROCFORPREP Name SSPROPVAL_ USEPROCFORPREP_OFF SSPROPVAL_ USEPROCFORPREP_ON Value SSPROPVAL_ USEPROCFORPREP_ ON_DROP Description A temporary stored procedure is not created when a command is prepared A temporary stored procedure is created when a command is prepared Temporary stored procedures are dropped when the session is released A temporary stored procedure is created when a command is prepared The procedure is dropped when the command is unprepared, or a new command text is set, or when all application references to the command are released ADO Data Types You might find the large array of data types supported by ADO confusing, especially since your language or database might not support them all This appendix details the DataTypeEnum constants and how they map to SQL and Access data types ODBC to Access 97 Database Type Text Memo Number (Byte) Number (Integer) Number (Long Integer) Number (Single) Number (Double) Number (Replication ID) Date/Time Currency Long Integer Yes/No OLE Object Hyperlink ADO Type adVarChar adLongVarChar adUnsignedTinyInt adSmallInt adInteger adSingle adDouble adGUID adDBTimeStamp adCurrency adInteger adBoolean adLongVarBinary adLongVarChar 605 ADO Data Types ODBC to Access 2000 Database Type Text Memo Number (Byte) Number (Integer) Number (Long Integer) Number (Single) Number (Double) Number (Replication ID) Number (Decimal) Date/Time Currency AutoNumber Yes/No OLE Object Hyperlink ADO Type adVarWChar adLongVarWChar adUnsignedTinyInt adSmallInt adInteger adSingle adDouble adGUID adNumeric adDBTimeStamp adCurrency adInteger adBoolean adLongVarBinary adLongVarWChar ODBC to SQL 6.5 Database Type binary bit char datetime decimal float image int money numeric real smalldatetime smallint smallmoney sysname text timestamp tinyint varbinary varchar ADO Type adBinary adBoolean adChar adDBTimeStamp adNumeric adDouble adLongVarBinary adInteger adCurrency adNumeric adSingle adDBTimeStamp adSmallInt adCurrency adVarChar adLongVarChar adBinary adUnsignedTinyInt adVarBinary adVarChar 606 ADO Data Types ODBC to SQL 7.0 Database Type binary bit char datetime decimal float image int money nchar ntext numeric nvarchar real smalldatetime smallint smallmoney text timestamp tinyint uniqueidentifier varbinary varchar ADO Type adBinary adBoolean adChar adDBTimeStamp adNumeric adDouble adLongVarBinary adInteger adCurrency adWChar adLongVarWChar adNumeric adVarWChar adSingle adDBTimeStamp adSmallInt adCurrency adLongVarChar adBinary adUnsignedTinyInt adGUID adVarBinary adVarChar Native Jet Provider to Access 97 Database Type Text Memo Number (Byte) Number (Integer) Number (Long Integer) Number (Single) Number (Double) Number (Replication ID) Date/Time Currency Long Integer Yes/No OLE Object ADO Type adVarWChar adLongVarWChar adUnsignedTinyInt adSmallInt adInteger adSingle adDouble adGUID adDate adCurrency adInteger adBoolean adLongVarBinary 607 ADO Data Types Hyperlink adLongVarWChar Native Jet Provider to Access 2000 Database Type Text Memo Number (Byte) Number (Integer) Number (Long Integer) Number (Single) Number (Double) Number (Replication ID) Number (Decimal) Date/Time Currency AutoNumber Yes/No OLE Object Hyperlink ADO Type adVarWChar adLongVarWChar adUnsignedTinyInt adSmallInt adInteger adSingle adDouble adGUID adNumeric adDate adCurrency adInteger adBoolean adLongVarBinary adLongVarWChar Native SQL Provider to SQL Server 6.5 Database Type binary bit char datetime decimal float image int money numeric real smalldatetime smallint smallmoney sysname text timestamp tinyint varbinary varchar ADO Type adBinary adBoolean adChar adDBTimeStamp adNumeric adDouble adLongVarBinary adInteger adCurrency adNumeric adSingle adDBTimeStamp adSmallInt adCurrency adVarChar adLongVarChar adBinary adUnsignedTinyInt adVarBinary adVarChar 608 ADO Data Types Native SQL Provider to SQL Server 7.0 Database Type binary bit char datetime decimal float image int money nchar ntext numeric nvarchar real smalldatetime smallint smallmoney text timestamp tinyint uniqueidentifier varbinary varchar ADO Type adBinary adBoolean adChar adDBTimeStamp adNumeric adDouble adLongVarBinary adInteger adCurrency adWChar adLongVarWChar adNumeric adVarWChar adSingle adDBTimeStamp adSmallInt adCurrency adLongVarChar adBinary adUnsignedTinyInt adGUID adVarBinary adVarChar Language Types The following table lists the data types you should use in your programming language A blank value indicates that the language does not natively support the data type, although there may be support in other libraries, or other data types might be used instead For example, the com.ms.wfc.data import library for J++ has support for dates and timestamp types, amongst others, but these are not supported by J++ natively Constant adBinary adBoolean adChar adCurrency adDate adDBTimeStamp adDouble Visual Basic Variant Boolean String Currency Date Variant Double Visual C++ Visual J++ bool char[ ] boolean String double double 609 ADO Data Types adGUID adInteger adLongVarBinary adLongVarChar adNumeric adSingle adSmallInt adUnsignedTinyInt adVarBinary adVarChar adVarWChar Long Variant String Single Integer Byte String String char[ ] int String, char[ ] int float short char char[ ] char[ ] char[ ] float short byte byte[ ] String, byte[ ] String, byte[ ] 610 Appendix L: The Microsoft Script Encoder The Microsoft Script Encoder is a simple command−line tool that lets you encode your scripts to deter people from viewing or modifying your source However, the Script Encoder will not prevent a determined hacker from viewing your code The Script Encoder can be used to encode the following file types: asa, asp, cdx, htm, html, js, sct, and vbs Only the scripting code within those files is encoded all of the other content is left as plain text You can use the encoding marker, '**Start Encode**, to determine where in the script block encoding starts: 'Copyright 1999 by John Doe '**Start Encode** code Instead of the whole script block being encoded, only the content below the '**Start Encode** line is encoded By using the encoding marker, you can specify a copyright or a description of the script, while protecting the code itself Once this file has been encoded, the script block would be changed to look like this: 'Copyright 1999 by John Doe '**Start Encode** encoded code Script Encoder Syntax This section describes how to use the Script Encoder executable, screnc.exe, to encode your scripts Syntax SCRENC [/s] [/f] [/xl] [/l defLanguage] [/e defExtension] inputfile outputfile Parameter /s /f /xl /l defLanguage /e defExtension Description Optional This switch instructs Script Encoder to not produce any screen output Optional This switch specifies that the input file is to be overwritten by the output file This option will destroy your source file, so be careful when using it Optional This switch specifies that the @language directive is not to be added at the top of asp files Optional This switch specifies the default scripting language to use during encoding Any script blocks encountered that not contain a language attribute are assumed to be of this specified language If this parameter is omitted, JScript is used as the default language for HTML and scriptlets; VBScript is the default for Active Server Pages For plain text files, the default language is determined by the file extension (.js or vbs) Optional This switch associates the input file with a specific file type Use this switch when the input file's extension is not one of the recognized extensions, or to override the existing extension If you don't specify this parameter and use an input file with an unrecognized extension, Script Encoder will fail for that file 611 Appendix L: The Microsoft Script Encoder inputfile Required The name of the file to be encoded outputfile Required The name of the output file to be produced The following table shows what the Script Encoder will encode for the file types: File Extension asp, asa, cdx htm, html js, vbs sct, wsh Encodes and/or The whole file Extension is changed to jse or vbe, respectively Examples To encode testsrc.asp into test.asp, use: screnc testsrc.asp test.asp To encode testsrc.asp into testsrc.asp, use: screnc /f testscr.asp To encode all of the html files in the c:\inetpub\test directory and put them in the c:\inetpub\wwwroot directory, use: screnc c:\inetpub\test\*.html c:\inetpub\wwwroot To encode all files in the current directory as vbs files silently and then put the output files in the directory c:\temp, use: screnc /s /e vbs *.* c:\temp To encode testsrc.html to test.html and specifying VBScript as the default language, use: screnc /l vbscript testsrc.html test.html Important Note: the Script Encoder can't handle empty elements Even with explicit opening and closing elements (with no content but a src attribute), the external file isn't encoded This is a known and acknowledged problem and you need to fix these by hand as needed For file types ws(f), wsc, and hta, you have to use the /e html switch and use an explicit encode file name, like: srcenc /e html mytest.hta mytest_encode.hta since the entire file isn't encoded (just the elements) 612 ... complete reference to the functions, keywords, and operators of the VBScript language Finally, don't forget that we, at Wrox, offer comprehensive on−line support and references www.webdev .wrox. co.uk... anywhere that VBScript can be used Before VBScript version 10 What Can You Do With VBScript? 5, JScript provided more features than VBScript Awhile back, Microsoft pledged to keep VBScript on a... to take a look at the What Can You Do With VBScript? and What's New in VBScript sections of this Introduction What is VBScript? As its name suggests, VBScript is what's known as a scripting language

Ngày đăng: 19/03/2019, 11:00

TỪ KHÓA LIÊN QUAN