DOC: Values for Scripting Object Constants DefinedID: Q163009
|
The version of VBScript (VBS) provided with Active Server Pages currently
does not have access to the values of constants defined by the Scripting
object. As a result, you must provide a definition of the constants you
wish to use in your scripts. Because the documentation does not provide the
values for these constants, it can be difficult to determine what the
numerical value is for a given constant.
Consider the following code example:
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile("c:\testfile.txt", ForAppending, FALSE)
If you cut and paste this code into an .asp file, you get the following
error because VBS doesn't recognize "ForAppending":
The best approach is to use a server-side include file to provide a definition of the constants for your script. This is similar to using the Adovbs.inc or Adojavas.inc files provided with ADO.Microsoft VBScript runtime error '800a0005' Invalid procedure call or argument: 'fs.OpenTextFile'
Here is a list of the values of the most commonly used constants for the
Scripting object:
iomode
<!--#include virtual="/ASPSAMP/SAMPLES/FILEVBS.INC"-->
(Save the text below to file: Filevbs.inc)
<%
'----------------------------------------------
'
' FileSystemObject constants include file for VBScript
'
'----------------------------------------------------->
'---- iomode Values ----
Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2
'---- format Values ----
Const TristateFalse = 0
Const TristateMixed = -2
Const TristateTrue = -1
Const TristateUseDefault = -2
%>
For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:
http://support.microsoft.com/support/vinterdev/
Additional query words:
Keywords : kbsample kbdocfix kbActiveX kbASP kbCOMt kbVisID100 kbGrpASP
Version : winnt:
Platform : winnt
Issue type :
Last Reviewed: May 27, 1999