|
Version 5 |
askSam Systems Inc.
askSam 5 SDK – Documentation for Visual Basic & ASP
askSam 5 Database Engine Software Development Kit
askSam Systems Inc.
askSam 5 SDK - Documentation
ă askSam Systems Inc.
Phone 850.584.6590 • Fax 850.584.7481
Table of Contents
Overview
of the askSam 5 Database Engine
Characteristics of the
askSam Database Engine
Functionality of the askSam
Engine
Installing
the askSam Database Engine
To install the askSam
Engine you download from the Internet:
To install the askSam
Database Engine from CD-Rom
Details about the
Installation Process:
Configuring the Active
Sever Page Example
Creating files for use with
the askSam Engine
Documents and Outputting
Documents
Using
the askSam Engine in a Visual Basic program
Defining an object with the
CreateObject command
Accessing the askSam Engine
using OLE Automation
Visual Basic Sample
Application
Using
the askSam Engine in Active Server Programming
Accessing the askSam Engine via Active Server Pages
Active Server Page Sample
Application
Component
Application Programming Interfaces (APIs)
GetAsFileCreationDateTime
Function
GetAsFileModifiedDateTime
Function
GetFileAccessGroupNames
Function ^
GetAccessGroupNames
Function ^
GetFirstAccessGroup
Function ^
GetAccessGroupReadOnly
Function ^ vb – asp - comments
GetAccessGroupBits1
Function ^ vb – asp - comments
GetAccessGroupBits2
Function ^ vb – asp - comments
AuthenticateAccessGroup
Function
SetAccessGroup
Function ^ vb – asp - comments
GetCurrentFileAccess
Function ^ vb – asp - comments
GetASW3ImportStatus
Function ^ vb – asp - comments
ImportASW3Cancel
Function ^ vb – asp - comments
GetIndexStatus
Function ^ vb – asp - comments
GetIndexStatistics
Function ^ vb – asp - comments
GetPackStatus
Function ^ vb – asp - comments
GetPackStatistics
Function ^ vb – asp - comments
CancelPack
Function ^ vb – asp - comments
DoesFileNeedPacking
Function ^
GetSizeFragmentedSpace
Function vb
GetPackStatusAfter
Function ^ asp – vb
GetMatchContext
Function ^ vb – asp - comments
SearchGetMaxHits
Function ^ vb
GetOutput
Function ^^ VB - ASP
SetFieldData
Function ^ asp - vb
GetNextEntryFormCounter
Function
SetMinimumNewRecSize
Function ^ vb - asp
GetIndexMemSize
Function ^ vb - asp
LoadGraphic
Function ^ vb – asp
SaveDelimitedDoc
Function vb – asp - comments
SaveDelimitedDocAppendEntryForm
Function vb – asp - comments
RunReport
Function vb – asp - comments
GetCryptStatus
Function vb – asp - comments
CancelCrypt
Function vb – asp - comments
GetASFilePackedDateTime
Function
GetDocBulk
Function vb – asp - comments
GetDocPackage
Function vb – asp - comments
GetEntryFormShortcutKey
Function
CopyDocToFile
Function vb – asp - comments
CopyDocument
Function vb – asp - comments
CopyEntryFormToDocument
Function vb – asp - comments
ASFindReplaceText
Function vb – asp - comments
LoadMultipleDocs
vb – asp - comments
EndLoadMultipleDocs
vb – asp - comments
FirstBookmark
Function vb – asp - comments
NextBookmark
Function vb – asp - comments
PickListSaveField
Function vb – asp - comments
PickListLoadField
Function vb – asp - comments
PickListGetFirstField
Function vb – asp - comments
PickListGetNextField
Function vb – asp - comments
PickListDeleteField
Function vb – asp - comments
SetNewDocLocation
Function ^ vb – asp - comments
GetNearSetting
Function ^ VB – ASP - comments
SetHideFieldCharacters
Function
SetPromptForDocProperties
Function
GetReportOuputSeparator ^ asp –vb - comments
SetReportOuputSeparator
Function –VB – asp - comments
GetDateTimeWeekFormat ^ asp –vb - comments
SetDateTimeWeekFormat
Function –VB – asp - comments
GetInterpretDateFormat
Function
SetInterpretDateFormat
Function
GetASCurrencyFormat
Function ^ vb – asp - comments
GetFileTextForeBackgroundColor
Function ^ vb – asp - comments
SetFileTextForeBackgroundColor
Function ^ vb – asp - comments
GetIndexDateNumFieldNames
Function
SetIndexDateNumFieldNames
Function
DeleteIndexDateNumFieldNames
Function
GetHighlightedMatchContext
Function
GetCountOutput
Function ^ vb – asp - comments
GetReportCommandString
Function
CopyStylesToFile
Function ^ vb – asp - comments
GetLastSearchHit
Function ^ vb
SetHTMLInfo
Function ^ VB- ASP -COMMENTS
GetNearSetting
Function ^ vb – asp
GetFileHighlightForeBackColor
Function ^ vb – asp
GetSearchStatus
Function ^ vb – asp
GetEntryFormAddLocation
Function ^ vb – asp
StopLoadDoc
Function ^ vb – asp
GetFileIgnoreCase
Function ^ vb – asp - comments
SetFileIgnoreCase
Function ^ vb – asp - comments
GetFileSearchOrder
Function ^ vb – asp - comments
SetFileSearchOrder
Function ^ vb – asp - comments
GetNumIndexWords
Function ^ vb – asp - comments
GetIndexWords
Function ^ vb – asp - comments
GetIndexWordsNum
Function ^ vb – asp - comments
FindStyle
Function ^ vb – asp - comments
|
Chapter 1 |
Introduction
|
t |
he askSam Database Engine lets you incorporate the free-form database capabilities of askSam in applications that you create. The 32-bit askSam database and text retrieval Engine can be integrated into Visual Basic, Java, .NET platform and C/C++ applications, as well as Active Server Page applications on Internet or intranet servers.
The examples we include in this documentation concentrate on using the askSam Engine with Active Server pages or with Visual Basic.
This Documentation is intended to provide a description of the programming interfaces available in the askSam Database Engine. The Documentation assumes you are familiar with the programming techniques and syntax of Visual Basic or Active Server pages. For more information on Visual Basic or Active Server page programming, there are a variety of third party publications available.
To change the shading of the Icon 1 Style, choose Borders
and Shading from the Format menu. Select a new shade or color, and choose
The askSam Engine was designed to be fast and flexible.
§ Fast - The askSam Engine provides some of the fastest and most powerful searches you'll find in any product.
§ Flexible - The askSam database was specifically designed to deal with free-form data. Unlike traditional database which require structured data. askSam can deal with both structured and unstructured information.
With the askSam Engine, your application has access to askSam's powerful search capabilities including full text searches, date, numeric, proximity, and Boolean searches, as well as fuzzy, wildcard and more. The askSam Engine will also allow you to perform many types of tasks including outputting reports, sorting information, and storing data in an easily retrievable format.
The askSam Engine was designed to give you access to the askSam's database and search functions. The Engine exposes functions which control:
§
how
an askSam file is searched
§
how search results are displayed
§
how data from a retrieved document is
displayed
The askSam Engine is designed to run on 32 bit Windows operating systems. It requires a minimal amount of resources (disk space and memory).
To run the askSam Engine you must have:
§ A computer running a Microsoft Windows 32 bit operating system (Windows 95, 98, ME, NT, 2000, or XP)
§ 15 MB of free disk space
NOTE: In order to do Active Server page programming, you will need to be running a Web server that supports Active Server pages. We've run all of our ASP code using Microsoft Internet Information Server.
You can either download the askSam Database Engine from the Internet, or you can receive the Database Engine on diskette. Maintenance releases and updates will be available on a regular basis from our Internet site: http://www.askSam.com/update/.
1.
Place the EXE file you download into a temporary
directory.
2.
Run the EXE.
3.
Follow the instructions on your screen.
4.
When the Setup is complete, delete the temporary
directory and the downloaded EXE.
1.
Insert the askSam Database Engine CD-Rom in your
CD-Rom drive.
2.
The installation program should start
automatically.
3.
Follow the instructions on your screen.
During the installation you will be asked for the location of the where to install the SDK. The default install location is C:\Program Files\askSam\askSam5\SDK. You can also enter a different path if you would like to change the default install path.
The Setup program automatically:
1.
Adds ‘askSam 5 SDK' to the Start | Programs
menu.
2.
Copies the following files to the selected
directory
GEAR81SD.DLL
AS_Eng5.DLL
ASENG5.TLB
ASENG5.OCX
SDKDocs5.ASK
AS_CRYPT.EXE
AS_CVT.EXE
AS_IDX.EXE
AS_PACK.EXE
REGSVR32.EXE
Examples\
Help\
1.
Copies a sample Visual Basic program into a
subdirectory named 'Examples\VB'
2.
Copies a sample Active Sever Page Program into a
subdirectory named Examples\asp'
3.
Copies a sample C/C++ Program into a
subdirectory named Examples\C\Demo'
4.
Copies the C/C++ Header file and Lib file for
Microsoft Visual C/C++ 6 SP3 into a subdirectory named Examples\C'
5.
Registers the askSam Database Engine for Visual
Basic or Active Server Pages.
Notes
1: The VB Sample application displays the README.ASK file. It is a simple application which uses the askSam Engine to display, search, and browse through an askSam file.
2: The ASENG5.BAS file contains all the pre-defined values you'll need to access the askSam Engine from a BASIC program. You can insert this file into any Visual Basic program. This file is saved in the VBsample subdirectory.
3: The ASKSAM.ASP file (in ASKASP subdirectory) contains all the pre-defined values you'll need to access the askSam Engine from an ASP program. It also contains some pre-defined functions which you can use in your ASP programs. You will want to add this file to any ASP program that uses the askSam Engine.
1.
Create a directory for your askSam ASP code
under the directory where Microsoft Internet Information Server (IIS) is
installed. By default, IIS is installed in the InetPub directory. In these configuration
instructions will assume you name the askSam ASP directory ASKASP.
2.
When you install the askSam Engine, we install
sample ASP code in an ASKASP directory under the askSam Engine. You will want
the contents of ASKASP subdirectory which we install into the ASKASP directory
you created in step #1.
3.
Create a Virtual Directory for the Active Server
Page sample program.
a)
Start the Microsoft Internet Service Manager
b)
Double Click on the WWW Service
c)
Under the WWW Service Properties select
Directories -> Add
d)
Enter the directory where you copied the askSam
ASP sample code. If you've used the directory names we've described, the
directory is C:\InetPub\ASKASP
e)
Name the Virtual Directory ASKASP
f)
Mark Read and Execute under Access
g)
Select OK
h)
Exit the Microsoft Internet Service Manager
4.
To access the ASP sample, use the URL -
http://<Domain>/ASKASP. Where Domain is your Domain name. This will display the Default.htm file and
give you access to the ASP sample.
Use askSam 5 to create and index the askSam files you will access with the askSam Engine. If you are testing the SDK, you can download a trial version of askSam 5 from our Web site (http://www.asksam.com/trial/asksam.asp), or contact our sales department for an evaluation copy (sales@askSam.com).
Like all databases, the data stored in an askSam database is divided into records. Since askSam does not have strict size limits or predefined structure for these records, we refer to them as "Documents".
The Documents stored in askSam can contain formatting information (such as fonts, colors, tabs, indents, etc.). When you access the data, you can have the askSam Engine return this data in one of three formats:
1.
TEXT
- removes all formatting and outputs ASCII text.
2.
RTF -
Microsoft's Rich Text Format retains all the formatting included in the
original askSam Document (such as fonts, colors, tabs, indents, etc.).
3. HTML - HTML retains the basic formatting which displays in a Web browser (font sizes, colors, bold and italic).
When you add a Document to an askSam file, askSam assigns a unique Document Handle to the Document. The Document Handle is how the askSam Engine accesses data stored in an askSam database.
For example, a search request passed to the askSam engine will return Document Handles from the Documents which match the request. Using these Document Handles, you can retrieve specific fields from the selected Documents, or you can retrieve the entire Document.
Note
The unique Document Handle generated for each Document is based upon the position (or address) of the Document in the database. Document Handles remain constant until a file is packed (a process which compresses and optimizes the database). During this process, askSam checks and removes any documents that have been marked for deletion. Packing generates a new set of Document Handles for the file. To Pack a file you use the FILE - PACK command in askSam for Windows.
If you need a reference to the document that doesn’t change after packing the database, you should use a document serial number. You can get a document serial number from a document handle by calling the GetDocSerialNum function.
The askSam Engine offers several ways to retrieve Document Handles. One way is to open a file, access the first document, and read the Document Handle from this Document. You can use functions provided by the askSam Engine to walk through the database and sequentially access each Document and read its Document Handle.
The following section of code retrieves the first document within the current open file:.
Example:
1: Set asksam = Form1.ASEng1
2: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
3:
4:
If asksam.IsFileOpened
Then
5:
6: Doc_Id = asksam.FirstDoc(DT_DATA)
7: RText1.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
8:
9: End If
The following section of code retrieves the next document within the current open file.
Example:
1: Set asksam = Form1.ASEng1
2: Cur_Id = Doc_Id
3: Doc_Id = asksam.NextDoc(Cur_Id, DT_DATA)
4: RText1.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
You can also access Document Handles from a search request. Pass the askSam Engine a search request. The Engine returns the Document Handles from the selected Documents.
Example:
1: Set asksam = Form1.ASEng1
2:
3: Prev_Doc = 0
4: Doc_Id = asksam.SearchFile(SearchString, Prev_Doc)
5:
6:
If Doc_Id
> 0 Then
7:
8: RText1.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
9:
10: End If
From your Visual Basic programs, you access the askSam Database Engine as an OCX (or ActiveX) Control. The askSam Engine can be accessed by two methods. These are described below:
The askSam Database Engine is registered with the name “ASKSAM.EngineCtrl.5” In your Visual Basic program, you can create an "asksam" object, and use this object to access the askSam database functions in your program.
Example:
Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
The first line creates the asksam object. This object gives you access to the commands in the askSam Database Engine. The second line uses the OpenASFile function in the askSam Database Engine. This function opens an askSam file. A description of all askSam Engine functions is included later in this documentation.
Note
For more information on the CreateObject command, see the Visual Basic Manual.
OLE Automation is the simplest way to access the askSam Database Engine from a Visual Basic program. First, add the askSam Engine to the OLE Tool Bar in Visual Basic. Then, place the askSam Engine in your VB Form (just as you would insert any other OLE object).
To add the askSam Database Engine to the OLE Toolbar:
a) Choose TOOLS -> CUSTOM CONTROLS
b) Select the “ASEng OLE Control Module”. The askSam Database Engine OLE Control will appear on the OLE Tool Bar.
Note
For more information using OLE Automation in Visual Basic programs, see your Visual Basic Manual.
We've included a VB sample application with the askSam Engine. The README.EXE in the Examples\VB directory is a Visual Basic program that uses the askSam Engine to display information in the QOL.ASK file.
This sample application demonstrates the following functions:
§ Opening an askSam file using the OpenASFile function
§ Closing an askSam file using the CloseASFile function
§ Searching an askSam file using the SearchFile function
§ Returning data from an askSam Documents as RTF data
§ Returning data from a specific field in and askSam Document using the GetFieldData function
§ Using the FirstDoc, NextDoc, PrevDoc, LastDoc, DeleteDoc, IsFileOpened functions
This sample application and the sample code in the documentation were created using Visual Basic 6.0 Service Pack 3.
The ASKSAM.BAS file (in Examples\VB subdirectory) was designed to simplify using the askSam Engine in Visual Basic programs. It contains definitions for the askSam API functions you can use in your programming.
You will want to add this file to a VB program that uses the askSam Engine.
The ASKSAM.BAS file contains several sections:
§ Document Types
§ Format Types
§ Saving Documents
§ Opening Documents
§ Loading Documents
Each section assigns a value to a variable name.
For example:
' Format Filter Types used when loading documents
Public Const FF_TEXT = &H1&
Public Const FF_HTML = &H2&
Public Const FF_RTF = &H4&
When using an askSam API functions, you would use the variable name rather than the value.
For example:
Text = asksam.LoadDoc(DT_DATA, FF_TEXT, Doc_Id)
You can view the ASKSAM.BAS using any text editor.
Active Server programming is a powerful way to access data on a Web server. In Active Server programming, you use a Visual Basic scripting language to manipulate and format data. Your scripts can access OCX Controls (ActiveX Controls). This adds a lot of functionality to the applications you can create using Active Server programming.
The askSam Engine is an OCX Control which you can access from the Active Server pages you create. Using Active Server pages, you can let people search, browse, and output reports from askSam databases.
Active Server programming offers a powerful way for people to create solutions on a Web-based platform. The ASP code is fairly standard VB scripting combined with HTML. The best part... because your application is executed on the Web server, it's platform independent. Anyone with a standard browser (Netscape Navigator, Microsoft Internet Explorer, etc) can run your application. It doesn't matter whether they are running a Windows PC, a Macintosh Computer, a Unix Workstation, or any other operating system.
To access the askSam Engine, define it as an object using the CreateObject command. The askSam Engine is registered under the name “ASKSAM.EngineCtrl.5”.
Example:
Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
The first line creates the asksam object. This object gives you access to the commands in the askSam Database Engine. The second line uses the OpenASFile function in the askSam Database Engine. This function opens an askSam file. A description of all askSam Engine functions is included later in this documentation.
We've included a Active Server Pages (ASP) sample application with the askSam Engine. The ‘Examples\ASP\Bulletin’ directory contains code for an ASP Bulletin application. The ‘Examples\ASP\WebPub’ directory contains code for an ASP application that simulates a lots of our Web Publisher product functionality.
This sample applications demonstrate the following functions:
§ Opening an askSam file
§ Closing an askSam file
§ Searching an askSam file
§ Returning askSam Documents as HTML data
§ Using the NextDoc and PrevDoc functions
§ Outputting fields from askSam Documents into an HTML table
§ Defining links from a table back to an askSam Document
The ASKSAM.ASP file (in Examples\ASP subdirectory) contains all the pre-defined values you'll need to access the askSam Engine from an ASP program. It also contains some pre-defined functions which you can use in your ASP programs.
You will want to add this file to any ASP page that uses the askSam Engine.
The ASKSAM.ASP file contains several sections:
§ Document Types
§ Format Types
§ Saving Documents
§ Opening Documents
§ Loading Documents
Each section assigns a value to a variable name. For example:
' Format Filter Types used when loading documents and data from fields
FF_TEXT = 1
FF_HTML = 2
FF_RTF = 4
When using an askSam API functions, you would use the variable name rather than the value. For example:
Text = asksam.LoadDoc(DT_DATA, FF_TEXT, Doc_Id)
You can view the ASKSAM.ASP using any text editor.
The sample applications and the sample code in the documentation were created and tested using Visual Basic Script on Microsoft Internet Information Server.
askSam offers a variety of powerful searches. You pass a search request to the askSam Engine using the SearchFile() function. Below are links to the askSam search commands:
§ Boolean Searches Use Boolean operators AND, OR, and NOT to combine elements in a search.
§ Wildcard Searches Wildcard searches let you find information without an exact match. askSam lets you use * and ? in your searches.
§ Searching For Phrases Search for multiple words as a single phrase.
§ Fuzzy Searching Helps locate information when you're not sure of the spelling.
§ Searching in a Field Restricts a search to the contents of a specific field.
§ Numeric Searches Searches based on numeric comparison (>, <, =, >=, <=, <>)
§ Proximity Searches Locates two words or phrases occurring within a specified proximity of one another.
§ Date Searches Searches based on date.
§ Case Sensitive Searches Determines whether searches are case sensitive.
§ Indexed Searches Uses the index to search a database. Increases search speed.
§ Sorting Outputs documents in sorted order.
askSam allows the use of the Boolean operators AND, OR, and NOT to combine the elements in your search.
Usage:
Enter: golf and tennis and beach
Find: documents containing the words golf, tennis, and beach
Enter: golf tennis beach
Find: documents containing the words golf, tennis, and beach
This search is identical to the first search.
Enter:
Find: documents containing either
Enter: not expensive and not crowded
Find: documents which do not contain the words expensive and crowded
Enter: red and (white or blue)
Find: documents containing red and either white or blue.
Enter: (red and white) or blue
Find: documents containing red and white or documents containing blue.
Sample Code:
11: <%@ Language=VBScript %>
12:
13: <!--#include file="askSam.asp"-->
14:
15: <%
16: File_Path = Server.MapPath("./")
17: File_Name = File_Path + "\bulletin.ask"
18:
19: Set asksam = Server.CreateObject("ASKSAM.EngineCtrl.5")
20: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
21:
22: If asksam.IsFileOpened Then
23:
24: Doc_Id = asksam.SearchFile("Tennis
25: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
26: Response.Write UserRecord
27: asksam.CloseASFile
28:
29: End If
30: %>
The previous sample could have been written like this:
31: <%@ Language=VBScript %>
32:
33: <!--#include file="askSam.asp"-->
34:
35: <%
36: File_Path = Server.MapPath("./")
37: File_Name = File_Path + "\bulletin.ask"
38: Set asksam = Server.CreateObject("ASKSAM.EngineCtrl.5")
39: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
40:
41: If asksam.IsFileOpened Then
42:
43: SearchRequest = "Tennis
44: Doc_Id = asksam.SearchFile(SearchRequest, 0)
45: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
46: Response.Write UserRecord
47: asksam.CloseASFile
48:
49: End If
50: %>
Wildcard searches let you find information without an exact match. Searches can include the wildcard symbols * and ?. The * replaces multiple characters (up to 80). The ? replaces a single character.
Usage:
Enter: German*
Find:
Enter: *CAD
Find: AutoCAD, NiCad, ...
Enter: 80?86
Find: 80286, 80386, 80486, ...
Sample Code:
51: <%@ Language=VBScript %>
52:
53: <!--#include file="askSam.asp"-->
54:
55: <%
56: File_Path = Server.MapPath("./")
57: File_Name = File_Path + "\bulletin.ask"
58: Set asksam = Server.CreateObject("ASKSAM.EngineCtrl.5")
59: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
60:
61: If asksam.IsFileOpened Then
62:
63: Doc_Id = asksam.SearchFile("German*", 0)
64: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
65: Response.Write UserRecord
66: asksam.CloseASFile
67:
68: End If
69: %>
The previous sample could have been written like this:
70: <%@ Language=VBScript %>
71:
72: <!--#include file="askSam.asp"-->
73:
74: <%
75: File_Path = Server.MapPath("./")
76: File_Name = File_Path + "\bulletin.ask"
77: Set asksam = Server.CreateObject("ASKSAM.EngineCtrl.5")
78: Search = Request.Form("SearchTerm")
79: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
80:
81: If asksam.IsFileOpened Then
82:
83: SearchRequest = Search & "*"
84: Doc_Id = asksam.SearchFile(SearchRequest, 0)
85: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
86: Response.Write UserRecord
87: asksam.CloseASFile
88:
89: End If
90: %>
Comments
on the Sample Code:
In the line:
Search = Request.Form("SearchTerm")
The data posted from your search form (referred to as "SearchTerm") is assigned to the variable "Search".
We then add the wildcard to the end of the search request in the line:
SearchRequest = Search & "*"
To Search for a phrase, the phrase must be enclosed in square brackets [ ]. Entering multiple words that are not enclosed in square brackets results in a Search for Documents containing all the requested words but the words do not have to appear together as a phrase.
Usage:
Enter: World Bank
Find: In today's world, the bank is an important institution.
To find words directly next to each other, place square brackets [ ] around the phrase.
Enter: [World Bank]
Find: Last year the World Bank lent record amounts to developing countries.
Sample Code:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.SearchFile("[World Bank]", 0)
15: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
16: Response.Write UserRecord
17:
18: asksam.CloseASFile
19:
20: End If
21: %>
The previous sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: Search = Request.Form("SearchTerm")
11: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
12:
13: If asksam.IsFileOpened Then
14:
15: SearchRequest = "[" & Search & "]"
16: Doc_Id = asksam.SearchFile(SearchRequest, 0)
17: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
18: Response.Write UserRecord
19:
20: asksam.CloseASFile
21:
22: End If
23: %>
Comments
on the Sample Code:
In the line:
Search = Request.Form("SearchTerm")
The data posted from your search form (referred to as "SearchTerm") is assigned to the variable "Search".
We then turn the search request into a Phrase Search by placing brackets around Search in the line:
SearchRequest = "[" & Search & "]"
A fuzzy search helps you locate information when you're not sure of the spelling
Usage:
Enter: {fuzzy} Kathy
Find: Documents containing either Kathy, Kathi, Cathy, etc.
Sample Code:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.SearchFile("{FUZZY} Kathy", 0)
15: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
16: Response.Write UserRecord
17:
18: asksam.CloseASFile
19:
20: End If
21: %>
The previous sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: Search = Request.Form("SearchTerm")
11: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
12:
13: If asksam.IsFileOpened Then
14:
15: SearchRequest = "{Fuzzy}" & Search
16: Doc_Id = asksam.SearchFile(SearchRequest, 0)
17: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
18: Response.Write UserRecord
19:
20: asksam.CloseASFile
21:
22: End If
23: %>
Comments
on the Sample Code:
In the line:
Search = Request.Form("SearchTerm")
The data posted from your search form (referred to as "SearchTerm") is assigned to the variable "Search".
Restricts an askSam search to a specific field.
Usage:
Syntax: word {IN} Fieldname
Enter: White {IN} Name:
Find: documents where White appears in the Name: field.
Enter: [Windows NT] {IN} OS:
Find: documents where the phrase Windows NT appears in the OS: field.
If the field you are searching is longer than a single line, use the long command to search the entire field.
Enter: askSam {IN LONG} Notes:
Find: documents where askSam appears anywhere in the Notes: field. The Notes field can be multiple lines.
Comments:
Use the LONG command with the IN command when you wish to search fields which are longer than one line. In askSam, a field can contain up to 16,000 lines of information. When using the LONG command, askSam assumes the multi-line field ends with a closing bracket "]". The LONG command lets you use a parameter to define how the field ends.
Enter: askSam {IN LONG :B } Notes:
Find: documents where askSam appears anywhere in the Notes: field. The Notes field ends when a Blank line is encountered.
If, instead of {IN LONG :B}, you place another character after the colon ( : ), that character will define the end of the field. For example:
Enter: askSam {IN LONG :/ } Notes:
Find: documents where askSam appears anywhere in the Notes: field. The Notes field ends when a slash / is encountered.
Sample Code:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.SearchFile("White {IN} Name:", 0)
15: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
16: Response.Write UserRecord
17:
18: asksam.CloseASFile
19:
20: End If
21: %>
The previous sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: Search = Request.Form("SearchTerm")
11: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
12:
13: If asksam.IsFileOpened Then
14:
15: SearchRequest = Search & "{IN LONG} Notes: "
16: Doc_Id = asksam.SearchFile(SearchRequest, 0)
17: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
18: Response.Write UserRecord
19:
20: asksam.CloseASFile
21:
22: End If
23: %>
Comments
on the Sample Code:
In the line:
Search = Request.Form("SearchTerm")
The data posted from your search form (referred to as "SearchTerm") is assigned to the variable "Search".
We then turn the search request into a Field Search by adding the command
"{in long} Notes: " to Search in the line:
SearchRequest = Search & "{IN LONG} Notes: "
A numeric search selects documents based on a numeric comparison (>, <, =, >=, <=, <>).
Usage:
Enter: Price: < 2,000
Find: documents where the number in the Price: field is less than 2000.
Comments:
You can use the following relational operators in numeric searches:
< less than
<= less than or equal to
= equal to
>= greater than or equal to
> greater than
<> not equal to
Sample Code:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.SearchFile("Price: < 2,000", 0)
15: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
16: Response.Write UserRecord
17:
18: asksam.CloseASFile
19:
20: End If
21: %>
The previous sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: Search = Request.Form("SearchTerm")
11: SearchComparison = Request.Form{"Comparison"}
12: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
13:
14: If asksam.IsFileOpened Then
15:
16: SearchRequest = "Price: " & SearchComparison & " " & Search
17: Doc_Id = asksam.SearchFile(SearchRequest, 0)
18: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
19: Response.Write UserRecord
20:
21: asksam.CloseASFile
22:
23: End If
24: %>
Comments
on the Sample Code:
In the line:
Search = Request.Form("SearchTerm")
The data posted from the search form (referred to as "SearchTerm") is assigned to the variable "Search".
In the line:
SearchComparison = Request.Form("Comparison"),
The data posted from the search form (referred to as "Comparison") is assigned to the variable "SearchComparison".
We then turn the search request into a Numeric Search using Search and SearchComparison in the line:
SearchRequest = "Price: " & SearchComparison & " " & Search
A Proximity Search locates two words or phrases occurring within a specified proximity of one another. This enables you to use the natural elements contained within blocks of normal text (Words, Lines, Sentences and Paragraphs) to tailor your search.
Usage:
Syntax: word1 {VICINITY :Parameter word2} or word1 {VIC :Parameter word2}
Enter: [Margaret Thatcher] {VICINITY :0P [Ronald Reagan]}
Find: documents where Margaret Thatcher and Ronald Reagan appear in the same paragraph.
Enter: Internet {VICINITY :1WB access}
Find: documents where Internet appears 1 word before access.
Enter: veto {VICINITY :2LA [President Clinton]}
Find: documents where veto appears within 2 lines after President Clinton.
Enter: GM {VICINITY :1SE Ford}
Find: documents where GM appears 1 sentence either side of Ford.
Enter: askSam {VICINITY :FL}
Find: documents where askSam appears in the first line.
Parameters:
W - Words
L - Lines
S - Sentences
P - Paragraphs
B - Before
A - After
E - On either side of
0 (Zero) - In the same Word, Line, Sentence, or Paragraph
FW - First Word
FL - First Line
FS - First Sentence
FP - First Paragraph
FX - First character x encountered, except W, S, P, L
Comments:
If you use any form of the First parameter (First Word, First Line, First Sentence, First Paragraph, or First character), do not specify Word2. Otherwise specify Word2 after the parameter.
Most VICINITY requests need three parameters:
a) The unit size (word, sentence, paragraph, etc.)
b) The number of units to look within (0, 1, 2, 3, etc.)
c) The direction to look (before or after).
You can mix these modifiers to create a variety of searches. Examples are above in the Usage section.
Sample Code:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.SearchFile("veto {VIC :2LA President}", 0)
15: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
16: Response.Write UserRecord
17:
18: asksam.CloseASFile
19:
20: End If
21: %>
The previous sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: FirstWord = Request.Form("FirstSearchTerm")
11: SecondWord = Request.Form("SecondSearchTerm")
12: SearchStructure = Request.Form("Structure")
13: SearchDirection = Request.Form("Direction")
14: SearchRange = Request.Form("Range")
15: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
16:
17: If asksam.IsFileOpened Then
18:
19: SearchRequest = FirstWord & " {VIC :" & SearchRange
20: SearchRequest = SearchRequest & SearchStructure & SearchDirection
21: SearchRequest = SearchRequest & " " & SecondWord & "}"
22: Doc_Id = asksam.SearchFile(SearchRequest, 0)
23: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
24: Response.Write UserRecord
25:
26: asksam.CloseASFile
27:
28: End If
29: %>
Comments on the Sample Code:
In the line:
FirstWord = Request.Form("FirstSearchTerm")
The data posted from the search form (referred to as "FirstSearchTerm") is assigned to the variable "FirstWord".
In the line:
SecondWord = Request.Form("SecondSearchTerm")
The data posted from the search form (referred to as "SecondSearchTerm") is assigned to the variable "SecondWord".
In the line:
SearchStructure = Request.Form("Structure")
The data posted from the search form (referred to as "Structure") is assigned to the variable "SearchStructure".
In the line:
SearchDirection = Request.Form("Direction")
The data posted from the form (referred to as "Direction") is assigned to the variable "SearchDirection".
In the line:
SearchRange = Request.Form("Range")
The data posted from the form (referred to as "Range") is assigned to the variable "SearchRange".
Using these values, we then turn the search request into a Proximity Search:
SearchRequest = FirstWord & " {VIC :" & SearchRange
SearchRequest = SearchRequest & SearchStructre & SearchDirection
SearchRequest = SearchRequest & " " & SecondWord & "}"
SearchRequest simply combines the user entered variables into one variable who's value equals:
FirstWord {VIC :SearchRange SearchStructure SearchDirection SecondWord}
The Date Search searches information according to a date
contained in a field. There are three types of date search:
Usage:
Single range ("find all documents earlier than...")
Enter: {cal} Date: < 01-01-98
Find: documents where the date in the Date:
field is before
Dual range ("find all documents from 1970 to 1980")
Enter: {cal} Born: >=
Find: documents with dates in the Born field between 1970 and 1980.
Comparison ("find documents with dates from the last 30 days")
Enter: {cal} Date: {to} [ ] <= 30 days
Find: documents where the date in the Date field is <= 30 days from today.
Enter: {cal} Date:{to}
Find: documents where the date is <= 2
months from
Enter: {cal} Date:{to} [ ] >= 1 year
Find: documents where the date in the Date field is >= 1 year from today.
Comments:
1. Dates
of varying formats can be mixed in a file and will still be understood. For
example, askSam can compare, sort and evaluate a file with dates such as
2. If a date in an unrecognized form is included, askSam will return an error. If a date field is blank, askSam uses the system date.
3. The date searches in the askSam Engine are set up to deal with four digit years. This allows you to do searches of data over multiple centuries.
4. You can use the following relational operators with your date searches:
< less than
<= less than or equal to
= equal to
>= greater than or equal to
> greater than
<> not equal to
5. The system date can be used in a request. It is represented by [ ] (brackets). The example of the Comparison Date Search demonstrates how this works.
Sample Code -
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: DateSearch = Request.Form("Date")
11: DateDirection = Request.Form("Range")
12: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
13:
14: If asksam.IsFileOpened Then
15:
16: SearchRequest = "{
17: Doc_Id = asksam.SearchFile(SearchRequest, 0)
18: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
19: Response.Write UserRecord
20:
21: asksam.CloseASFile
22:
23: End If
24: %>
Comments
on the Sample Code:
In the line:
DateSearch = Request.Form("Date")
The data posted from the search form (referred to as "Date") is assigned to the variable "DateSearch".
In the line:
DateDirection = Request.Form("Range")
The data posted from the search form (referred to as "Range") is assigned to the variable "DateDirection".
We then turn the search request into a Single Range Date Search using DateSearch and DateDirection in the line:
SearchRequest = "{
Sample Code -
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: StartDate = Request.Form("FirstDate")
11: EndDate = Request.Form("SecondDate")
12: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
13:
14: If asksam.IsFileOpened Then
15:
16: SearchRequest = "{
17: SearchRequest = SearchRequest & " {
18: Doc_Id = asksam.SearchFile(SearchRequest, 0)
19: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
20: Response.Write UserRecord
21:
22: asksam.CloseASFile
23:
24: End If
25: %>
Comments
on the Sample Code:
In the line:
StartDate = Request.Form("FirstDate")
The data posted from the search form (referred to as "FirstDate") is assigned to the variable "StartDate".
In the line:
EndDate = Request.Form("SecondDate")
The data posted from the search form (referred to as "SecondDate") is assigned to the variable "EndDate".
We then turn the search request into a Dual Range Date Search using StartDate and EndDate in the lines:
SearchRequest = "{
SearchRequest =
SearchRequest & " {
Sample Code - Comparison
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: StartDate = Request.Form("FirstDate")
11: EndDate = Request.Form("SecondDate")
12: SearchDirection = Request.Form("Direction")
13: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
14:
15: If asksam.IsFileOpened Then
16:
17: SearchRequest = "{
18: SearchRequest = SearchRequest & SearchDirection & " " & EndDate
19: Doc_Id = asksam.SearchFile(SearchRequest, 0)
20: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
21: Response.Write UserRecord
22:
23: asksam.CloseASFile
24:
25: End If
26: %>
Comments
on the Sample Code:
In the line:
StartDate = Request.Form("FirstDate")
The data posted from the search form (referred to as "FirstDate") is assigned to the variable "StartDate".
In the line:
EndDate = Request.Form("SecondDate")
The data posted from the search form (referred to as "SecondDate") is assigned to the variable "EndDate".
In the line:
27: SearchDirection = Request.Form("Direction")
The data posted from the form (referred to as "Direction") is assigned to the variable "SearchDirection".
We then turn the search request into a Dual Range Date Search using StartDate, EndDate and SearchDirection in the lines:
SearchRequest = "{
SearchRequest = SearchRequest & SearchDirection & " " & EndDate
By default, askSam searches are not case sensitive. When you search for a word, the case of the letters comprising the word is irrelevant. The CASE command lets you define a case sensitive search. The CAPS command switches back to a non-case sensitive search.
Usage:
Syntax: {CASE} search request {CAPS}
Enter: WHO
Find: Documents containing either Who, who, or WHO
Enter: {CASE} WHO {CAPS}
Find: Documents containing only WHO
Comments:
If the case command is used in a search request containing a field name, the case of the field is also considered when retrieving a record. For example:
{CASE} ABC Computing {IN} Company[
{CASE} ABC Computing {IN} COMPANY{
will retrieve different sets of documents. In the first example, only records are retrieved where the field name "Company" is written with an upper case "C". The second example will only retrieve records where the field name "COMPANY" is written in all upper case letters.
If you wanted to ignore the case in the rest of your request, you would enter the request as follows:
{CASE} ABC Computing {CAPS} {IN} Company[
Sample Code:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.SearchFile("{Case} Who {CAPS}", 0)
15: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
16: Response.Write UserRecord
17:
18: asksam.CloseASFile
19:
20: End If
21: %>
The previous sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: Search = Request.Form("SearchTerm")
11: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
12:
13: If asksam.IsFileOpened Then
14:
15: SearchRequest = "{Case} " & Search " {Caps}"
16: Doc_Id = asksam.SearchFile(SearchRequest, 0)
17: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
18: Response.Write UserRecord
19:
20: asksam.CloseASFile
21:
22: End If
23: %>
Comments
on the Sample Code:
One line 10:
Search = Request.Form("SearchTerm")
The data posted from the search form (referred to as "SearchTerm") is assigned to the variable "Search"
We then turn the search request into a Case Sensitive Search by adding the command
"{Case} " to Search in the line:
SearchRequest = "{Case} " & Search
Full-Text Indexing greatly speeds up searching in askSam files, especially in large files. With full-text indexing, you can search through a several hundred MB askSam file in a matter of seconds.
Usage:
If you index an askSam file, the askSam Engine will automatically use the index when searching that file. It is not necessary for you to modify your search request in any way.
Comments:
To index your file for use with the askSam Engine, you will need a copy of askSam Professional -- version 3.0H or later. Contact our Technical Department to get a copy (tech@askSam.com).
The Sort command allows you to output documents in sorted order. askSam can sort your Documents alphabetically, numerically, or by date.
Usage:
Syntax: search request {SORT :parameters Fieldname1 :parameters Fieldname2}
Enter: OPEN {IN} Status[ {SORT :CD Date[ :L Name[ }
Find: Documents with "Open" in the Status field. The documents are returned in sorted order. They are sorted in descending date order and then by the last word in the name field. For example:
Parameters:
C - sorts the Field by date (rather than alphabetically).
R# - sorts the Field numerically (# is the number of digits to sort on).
D - sorts the data in descending order (from Z-A or from 9-1 etc)
U - ignores the case (upper/lower) when sorting
I - ignores articles such as "the", "a", "an" when sorting
L - sorts on the last word in a field. Useful for name fields such as "John Smith"
Comments:
1. The Search Request should always precede the Sort request.
2. The Sort Command does not change the physical order of the Documents in your file. They are just displayed in a sorted order on your screen.
3. Dates
of varying formats can be mixed in a file and will still be understood. For
example, askSam can compare, sort and evaluate a file with dates such as
4. There can only be on SORT command per request, but the sort command allows you to sort on multiple fields.
Sample Code:
<%@ Language=VBScript %>
<!--#include file=“askSam.asp”-->
<%
File_Path = Server.MapPath("./")
File_Name = File_Path + "\bulletin.ask"
Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
If asksam.IsFileOpened Then
Doc_Id = asksam.SearchFile("{Sort :C Date:}", 0)
UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
Response.Write UserRecord
asksam.CloseASFile
End If
%>
The sample could have been written like this:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: Search = Request.Form("SearchTerm")
11: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
12:
13: If asksam.IsFileOpened Then
14:
15: SearchRequest = Search & " {Sort :C Date:}"
16: Doc_Id = asksam.SearchFile(SearchRequest, 0)
17: UserRecord = asksam.LoadDoc(DT_DATA, FF_HTML, Doc_Id)
18: Response.Write UserRecord
19:
20: asksam.CloseASFile
21:
22: End If
23: %>
Comments
on the Sample Code:
In the line:
24: Search = Request.Form("SearchTerm")
The data posted from the search form (referred to as "SearchTerm") is assigned to the variable "Search".
We then turn the search request into a date Sort by adding the command
" {Sort :C Date:}" to Search with the line:
25: SearchRequest = Search & " {Sort :C Date:}"
Syntax:
OpenAsFile(filename, how, share)
Purpose:
Opens an existing askSam file.
Parameters:
|
filename |
The
name of the file you wish to open. This value can include path information. |
|
how |
Specifies
how you wish to open the file. ASOF_READ - Opens the file for Read Only access. ASOF_READWRITE - Opens the file for Read and Write access. ASOF_WRITE - Opens the file for Write Only access. ASOF_NEW - Creates a new file with Read and Write access. |
|
share |
Determines
how this file is to be shared with other openers of the file. ASOF_READ - Others have Read access to the file. ASOF_READWRITE - Others have Read and Write access to the file. ASOF_WRITE - Others Write access to the file. ASOF_EXCLUSIVE - Does not allow others to access the file. You
have exclusive access to the file. |
Returns:
True if the file is successfully opened.
False if the file cannot be opened. Use the GetLastAsError function for further information.
Comments:
After using the OpenASFile function, you will need to close the file using the CloseAsFile function. The askSam Engine only allows you to open a single file per instance of the askSam Object. To open multiple askSam files at the same time, you will need to create multiple askSam Objects using the Dim, Set, and CreateObject VB functions.
ASOF_NEW - Creates a new file with Read and Write access.
The share value can only be set to exclusive (ASOF_EXCLUSIVE) if no other user has the file open when the OpenASFile function is executed.
You need to include the ASKSAM.BAS file in any VB project that uses the askSam Database Engine.
In any ASP file that uses the askSam Database Engine, you will need to include the ASKSAM.ASP file. You can do this by using the ASP Include statement shown in the ASP example below.
Visual Basic Example:
26: Path$ = App.Path
27: File_Name = Path$ & "\Readme.ask"
28: Dim asksam As Object
29:
30: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
31: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
32:
33: If asksam.IsFileOpened Then
34:
35: Doc_Id = asksam.FirstDoc(DT_DATA)
36: RichText.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
37:
38: asksam.CloseASFile
39:
40: Else
41:
42: Error_Id = asksam.GetLastASError()
43: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
44:
45: End If
46: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 opens the askSam file
Line 8 verifies that the askSam file is open
Line 10 retrieves the document handle of the first document in the askSam file.
Line 11 outputs the askSam document to the screen
Line 13 closes the askSam file
Line 17 retrieves the error id of the last error
Line 18 requests the error string for the error id and outputs it to the screen.
Line 21 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.FirstDoc(DT_DATA)
15: Text = asksam.LoadDoc(DT_DATA, FF_TEXT, Doc_Id)
16: Response.Write "<CENTER> The first document in the file is displayed"
17: Response.Write Text
18: Response.Write "</CENTER>"
19:
20: asksam.CloseASFile
21:
22: Else
23:
24: Error_Id = asksam.GetLastASError()
25: Text = asksam.ASErrorToString(Error_Id)
26: Response.Write "<CENTER> The following error occurred: <P>"
27: Response.Write Text
28: Response.Write "</CENTER>"
29:
30: End If
31: Set asksam = Nothing
32: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 verifies that the askSam file is open
Line 14 retrieves the document handle of the first document in the askSam file.
Line 15 loads the document into the variable named Text
Line 17 outputs the document
Line 20 closes the askSam file
Line 24 retrieves the error id of the last error
Line 25 requests the error string for the error id
Line 27 outputs the error string
Line 31 frees up the memory used by the askSam instance.
See Also:
OpenAsFileEx,
CloseASFile, IsFileOpened
Syntax:
OpenAsFileEx(filename, how, share, group, password)
Purpose:
Opens an askSam file that is protected with a password.
Parameters:
|
Filename |
The name of the file you
wish to open. This value can include path information. |
|
How |
Specifies how you wish to
open the file. ASOF_READ - Opens the file for Read Only access. ASOF_READWRITE - Opens the file for Read and Write access. ASOF_WRITE - Opens the file for Write Only access. ASOF_NEW - Creates a new file with Read and Write
access. |
|
Share |
Determines how this file is
to be shared with other openers of the file. ASOF_READ - Others have Read access to the file. ASOF_READWRITE - Others have Read and Write access to the
file. ASOF_WRITE - Others Write access to the file. ASOF_EXCLUSIVE - Does not allow others to access the file.
You have exclusive access to the file. |
|
Group |
The group name of the access
level to this file. |
|
password |
The password for the group. |
Returns:
True if the file is successfully opened.
False if the file cannot be opened. Use the GetLastAsError function for further information.
Comments:
After using the OpenASFile function, you will need to close the file using the CloseAsFile function.
The askSam Engine only allows you to open a single file per instance of the askSam Object. To open multiple askSam files at the same time, you will need to create multiple askSam Objects using the Dim, Set, and CreateObject VB functions.
ASOF_NEW = Creates a new file with Read and Write access.
The share value can only be set to exclusive (ASOF_EXCLUSIVE) if no other user has the file open when the OpenASFile function is processed.
You need to include the ASKSAM.BAS file in any VB project that uses the askSam Database Engine.
In any ASP file that uses the askSam Database Engine, you will need to include the ASKSAM.ASP file. You can do this by using the ASP Include statement shown in the ASP example below.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFileEx File_Name, ASOF_READ, ASOF_READWRITE, "Supervisor", "Password"
7:
8:
If asksam.IsFileOpened
Then
9:
10: Doc_Id = asksam.FirstDoc(DT_DATA)
11: RichText.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
12:
13: asksam.CloseASFile
14:
15: Else
16:
17: Error_Id = asksam.GetLastASError()
18: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
19:
20: End If
21: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 opens the askSam file
Line 8 verifies that the askSam file is open
Line 10 retrieves the document handle of the first document in the askSam file.
Line 11 outputs the askSam document to the screen
Line 13 closes the askSam file
Line 17 retrieves the error id of the last error
Line 18 requests the error string for the error id and outputs it to the screen.
Line 21 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("/asp_test")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFileEx File_Name, ASOF_READ, ASOF_READWRITE, "Supervisor", "Password"
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.FirstDoc(DT_DATA)
15: Text = asksam.LoadDoc(DT_DATA, FF_TEXT, Doc_Id)
16: Response.Write "<CENTER> The first document in the file is displayed"
17: Response.Write Text
18: Response.Write "</CENTER>"
19:
20: asksam.CloseASFile
21:
22: Else
23:
24: Error_Id = asksam.GetLastASError()
25: Text = asksam.ASErrorToString(Error_Id)
26: Response.Write "<CENTER> The following error occurred: <P>"
27: Response.Write Text
28: Response.Write "</CENTER>"
29:
30: End If
31: Set asksam = Nothing
32: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 verifies that the askSam file is open
Line 14 retrieves the document handle of the first document in the askSam file.
Line 15 loads the document into the variable named Text
Line 17 outputs the document
Line 20 closes the askSam file
Line 24 retrieves the error id of the last error
Line 25 requests the error string for the error id
Line 27 outputs the error string
Line 31 frees up the memory used by the askSam instance.
See Also:
CloseAsFile,
OpenAsFile, IsFileOpened
Syntax:
CloseAsFile()
Purpose:
Closes the current askSam file.
Returns:
True if the file is successfully closed.
False if the file cannot be closed. Use the GetLastAsError function for further information.
Comments:
It is important to close all files when you finish with them.
You need to include the ASKSAM.BAS file in any VB project that uses the askSam Database Engine.
In any ASP file that uses the askSam Database Engine, you will need to include the ASKSAM.ASP file. You can do this by using the ASP Include statement shown in the ASP example below.
Visual Basic Example:
33: Path$ = App.Path
34: File_Name = Path$ & "\Readme.ask"
35: Dim asksam As Object
36:
37: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
38: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
39:
40: If asksam.IsFileOpened Then
41:
42: Doc_Id = asksam.FirstDoc(DT_DATA)
43: RichText.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
44:
45: asksam.CloseASFile
46:
47: Else
48:
49: Error_Id = asksam.GetLastASError()
50: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
51:
52: End If
53: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 opens the askSam file
Line 8 verifies that the askSam file is open
Line 10 retrieves the document handle of the first document in the askSam file.
Line 11 outputs the askSam document to the screen
Line 13 closes the askSam file
Line 17 retrieves the error id of the last error
Line 18 requests the error string for the error id and outputs it to the screen.
Line 21 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.IsFileOpened Then
13:
14: Doc_Id = asksam.FirstDoc(DT_DATA)
15: Text = asksam.LoadDoc(DT_DATA, FF_TEXT, Doc_Id)
16: Response.Write "<CENTER> The first document in the file is displayed"
17: Response.Write Text
18: Response.Write "</CENTER>"
19:
20: asksam.CloseASFile
21:
22: Else
23:
24: Error_Id = asksam.GetLastASError()
25: Text = asksam.ASErrorToString(Error_Id)
26: Response.Write "<CENTER> The following error occurred: <P>"
27: Response.Write Text
28: Response.Write "</CENTER>"
29:
30: End If
31: Set asksam = Nothing
32: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 verifies that the askSam file is open
Line 14 retrieves the document handle of the first document in the askSam file.
Line 15 loads the document into the variable named Text
Line 17 outputs the document
Line 20 closes the askSam file
Line 24 retrieves the error id of the last error
Line 25 requests the error string for the error id
Line 27 outputs the error string
Line 31 frees up the memory used by the askSam instance.
Syntax:
IsFileOpened()
Purpose:
Determines if the askSam file was opened successfully
Returns:
True if the file is open
False if the file is not open. Use the GetLastAsError function for further information.
Comments:
It is important to close all files when you finish with them.
You need to include the ASKSAM.BAS file in any VB project that uses the askSam Database Engine.
In any ASP file that uses the askSam Database Engine, you will need to include the ASKSAM.ASP file. You can do this by using the ASP Include statement shown in the ASP example below.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: Doc_Id = asksam.FirstDoc(DT_DATA)
11: RichText.TextRTF = asksam.LoadDoc(DT_DATA, FF_RTF, Doc_Id)
12:
13: asksam.CloseASFile
14:
15: Else
16:
17: Error_Id = asksam.GetLastASError()
18: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
19:
20: End If
21: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 opens the askSam file
Line 8 verifies that the askSam file is open
Line 10 retrieves the document handle of the first document in the askSam file.
Line 11 outputs the askSam document to the screen
Line 13 closes the askSam file
Line 17 retrieves the error id of the last error
Line 18 requests the error string for the error id and outputs it to the screen.
Line 21 frees up the memory used by the askSam instance.
Active Server Pages Example:
22: <%@ Language=VBScript %>
23:
24: <!--#include file=“askSam.asp”-->
25:
26: <%
27: File_Path = Server.MapPath("./")
28: File_Name = File_Path + "\bulletin.ask"
29:
30: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
31: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
32:
33: If asksam.IsFileOpened Then
34:
35: Doc_Id = asksam.FirstDoc(DT_DATA)
36: Text = asksam.LoadDoc(DT_DATA, FF_TEXT, Doc_Id)
37: Response.Write "<CENTER> The first document in the file is displayed"
38: Response.Write Text
39: Response.Write "</CENTER>"
40:
41: asksam.CloseASFile
42:
43: Else
44:
45: Error_Id = asksam.GetLastASError()
46: Text = asksam.ASErrorToString(Error_Id)
47: Response.Write "<CENTER> The following error occurred: <P>"
48: Response.Write Text
49: Response.Write "</CENTER>"
50:
51: End If
52: Set asksam = Nothing
53: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 verifies that the askSam file is open
Line 14 retrieves the document handle of the first document in the askSam file.
Line 15 loads the document into the variable named Text
Line 17 outputs the document
Line 20 closes the askSam file
Line 24 retrieves the error id of the last error
Line 25 requests the error string for the error id
Line 27 outputs the error string
Line 31 frees up the memory used by the askSam instance.
Syntax:
DeleteAsFile(filename)
Purpose:
deletes an askSam file.
Parameters:
|
filename |
The
name of the file you wish to delete. This value can include path information. |
Returns:
True if the file is successfully deleted.
False if the file cannot be deleted. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6:
If askSam.DeleteAsFile(File_Name)
Then
7:
8: RichText.TextRTF = "The file was deleted"
9:
10: Else
11:
12: RichText.TextRTF = "The file was NOT deleted"
13: Error_Id = asksam.GetLastASError()
14: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
15:
16: End If
17: Set asksam = Nothing
18:
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 deletes the askSam file
Line 13 retrieves the error id of the last error
Line 14 requests the error string for the error id and outputs it to the screen.
Line 17 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: If asksam.DeleteAsFile(File_Name) Then
11:
12: Response.Write "<CENTER> The file was deleted!</CENTER>"
13:
14: Else
15:
16: Response.Write "<CENTER> The file was NOT deleted!</CENTER>"
17: Error_Id = asksam.GetLastASError()
18: Text = asksam.ASErrorToString(Error_Id)
19: Response.Write "<CENTER> The following error occurred: <P>"
20: Response.Write Text
21: Response.Write "</CENTER>"
22:
23: End If
24: Set asksam = Nothing
25: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 deletes the askSam file
Line 17 retrieves the error id of the last error
Line 18 requests the error string for the error id
Line 20 outputs the error string
Line 24 frees up the memory used by the askSam instance.
Syntax:
CopyAsFile(filename of file to be copied,
filename of file to be created)
Purpose:
copies an askSam file.
Parameters:
|
filename of file to be copied |
The
name of the askSam file you wish to copy. This value can include path
information. |
|
filename of file to be
created |
The
name of the askSam file you wish to create. This value can include path
information. |
Returns:
True if the file is successfully created.
False if the file cannot be created. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6:
If askSam.CopyAsFile(File_Name_Old,
File_Name_New) Then
7:
8: RichText.TextRTF = "The file was copied"
9:
10: Else
11:
12: RichText.TextRTF = "The file was NOT copied"
13: Error_Id = asksam.GetLastASError()
14: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
15:
16: End If
17: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 copies the askSam file
Line 13 retrieves the error id of the last error
Line 14 requests the error string for the error id and outputs it to the screen.
Line 17 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath("./")
7: File_Name = File_Path + "\bulletin.ask"
8: New_File_Name = File_Path + "\bulletin_copy.ask"
9:
10: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
11: If asksam.CopyAsFileSettings(File_Name,
New_File_Name) Then
12:
13: Response.Write "<CENTER> The Settings were copied!</CENTER>"
14:
15: Else
16:
17: Response.Write "<CENTER> The Settings were NOT copied! </CENTER>"
18: Error_Id = asksam.GetLastASError()
19: Text = asksam.ASErrorToString(Error_Id)
20: Response.Write "<CENTER> The following error occurred: <P>"
21: Response.Write Text
22: Response.Write "</CENTER>"
23:
24: End If
25: Set asksam = Nothing
26:
27: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 10 creates an instance of the asksam database engine
Line 11 copies the askSam file
Line 18 retrieves the error id of the last error
Line 19 requests the error string for the error id
Line 21 outputs the error string
Line 25 frees up the memory used by the askSam instance.
Syntax:
CopyAsFileSettings(filename
of file to be copied from, filename of file to be copied to)
Purpose:
Copies the File Property Settings, Styles, Entry Forms, Reports, Mail Merge, Remembered Lists, Index Noise Words, Punctuation Settings, Sort Articles, Sort Table, File Access Security Settings, Stored Searches, Search Results Views and Pick Lists from one askSam file to another. The file being copied to must be opened in Exclusive mode. .
Parameters:
|
Filename of file to be copied
from |
The
name of the askSam file you wish to copy the settings from. This value can
include path information. |
|
Filename of file to be copied
to |
The
name of the askSam file you wish to copy the settings into. This value can
include path information. |
Returns:
True if the settings are successfully copied.
False if the settings cannot be copied. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6:
If askSam.CopyAsFileSettings(File_Name_Copy,
File_Name_New) Then
7:
8: RichText.TextRTF = "The file settings were copied"
9:
10: Else
11:
12: RichText.TextRTF = "The file settings were NOT copied"
13: Error_Id = asksam.GetLastASError()
14: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
15:
16: End If
17: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 copies the askSam file settings.
Line 13 retrieves the error id of the last error
Line 14 requests the error string for the error id and outputs it to the screen.
Line 17 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(".")
7: File_Name = File_Path + "\bulletin.ask"
8:
9:
10: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
11: If asksam.CopyAsFileSettings(File_Name,
New_File_Name) Then
12:
13: Response.Write "<CENTER> The Settings were copied!</CENTER>"
14:
15: Else
16:
17: Response.Write "<CENTER> The Settings were NOT copied! </CENTER>"
18: Error_Id = asksam.GetLastASError()
19: Text = asksam.ASErrorToString(Error_Id)
20: Response.Write "<CENTER> The following error occurred: <P>"
21: Response.Write Text
22: Response.Write "</CENTER>"
23:
24: End If
25: Set asksam = Nothing
26: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 10 creates an instance of the asksam database engine
Line 11 copies the askSam file settings
Line 18 retrieves the error id of the last error
Line 19 requests the error string for the error id
Line 21 outputs the error string
Line 25 frees up the memory used by the askSam instance.
Syntax:
GetAsFileSize(high size)
Purpose:
Retrieves the size of the askSam file. The returned size does not include the size of the DTA and IDX files used to store the index information.
Parameters:
|
high size |
The
file size value variable name |
Returns:
File Size if the file size is retrieved successfully.
False if the file size can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If askSam.GetAsFileSize(value)
<> 0 Then
9:
10: RichText.TextRTF = "The file size is" & value
11:
12: Else
13:
14: RichText.TextRTF = "The file size was NOT retrieved"
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
19: asksam.CloseAsFile
20: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 opens the askSam file.
Line 8 retrieves the size of the open askSam file
Line 10 outputs the file size
Line 15 requests the error id
Line 16 request the error string for the error id and outputs it to the screen.
Line 19 closes the askSam file
Line 20 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(".")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
11:
12: If asksam.GetAsFileSize(value) <> 0 Then
13:
14: Response.Write "<CENTER> The file size is: "
15: Response.Write value & "</CENTER>"
16:
17: Else
18:
19: Response.Write "<CENTER> The file size was NOT retrieved! </CENTER>"
20: Error_Id = asksam.GetLastASError()
21: Text = asksam.ASErrorToString(Error_Id)
22: Response.Write "<CENTER> The following error occurred: <P>"
23: Response.Write Text
24: Response.Write "</CENTER>"
25:
26: End If
27: asksam.CloseAsFile
28: Set asksam = Nothing
29: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the askSam file size
Line 20 retrieves the error id of the last error
Line 21 requests the error string for the error id
Line 23 outputs the error string
Line 27 closes the askSam file
Line 28 frees up the memory used by the askSam instance.
Syntax:
GetAsFileCreationDateTime()
Purpose:
Retrieves the date and time the askSam file was created.
Returns:
Creation Date if the file creation date is retrieved successfully.
False if the file creation date can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetAsFileCreationDateTime
11:
12: Else
13:
14: Error_Id = asksam.GetLastASError()
15: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
16:
17: End If
18: asksam.CloseASFile
19: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the asksam database engine
Line 6 opens the askSam file.
Line 10 retrieves and outputs the the creation date and time of the open askSam file
Line 14 requests the error id
Line 15 requests the error string for the error id and outputs it to the screen.
Line 18 closes the askSam file
Line 19 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name , ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetAsFileCreationDateTime
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "File was created= " & value & "<BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the askSam file creation data and time
Line 14 outputs the file creation date and time.
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
GetAsFileModifiedDateTime()
Purpose:
Retrieves the date and time the askSam file was last modified.
Returns:
Last Modified Date if the file modified date is retrieved successfully.
False if the file modified date can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetAsFileModifiedDateTime
11:
12: Else
13:
14: Error_Id = asksam.GetLastASError()
15: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
16:
17: End If
18: asksam.CloseASFile
19: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file.
Line 8 confirms the file is open
Line 10 retrieves and outputs the the last modified date and time of the open askSam file
Line 14 requests the error id
Line 15 requests the error string for the error id and outputs it to the screen.
Line 18 closes the askSam file
Line 19 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name , ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetAsFileModifiedDateTime
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "File was modified= " & value & "<BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the askSam file last modified data and time
Line 14 outputs the last modified date and time
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
GetAsFileName()
Purpose:
Retrieves the name of the open askSam file.
Returns:
Path and Name of the Open File if the file information is retrieved successfully.
False if the file Path and Name can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetAsFileName
11:
12: Else
13:
14: Error_Id = asksam.GetLastASError()
15: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
16:
17: End If
18: asksam.CloseASFile
19: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file.
Line 8 confirms the file is open
Line 10 retrieves and outputs the file name of the current askSam file.
Line 14 requests the error id
Line 15 requests the error string for the error id and outputs it to the screen.
Line 18 closes the askSam file
Line 19 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name , ASOF_READWRITE, ASOF_READWRITE
11: value = asksam.GetASFileName
12: Response.Write "File Name= " & value & "<BR>"
13:
14: asksam.CloseASFile
15: Set asksam = Nothing
16: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants.
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 retrieves the askSam file name.
Line 12 outputs the askSam file name
Line 14 closes the askSam file
Line 15 frees up the memory used by the askSam instance.
Syntax:
GetFileAccessGroupNames(filename,
how, share )
Purpose:
Retrieves the list of file security group names defined in an unopened askSam file.
Parameters:
|
filename |
The
name of the file you wish to open. This value can include path information. |
|
how |
Specifies
how you wish to open the file. ASOF_READ - Opens the file for Read Only access. ASOF_READWRITE - Opens the file for Read and Write access. ASOF_WRITE - Opens the file for Write Only access. ASOF_NEW - Creates a new file with Read and Write access. |
|
share |
Determines
how this file is to be shared with other openers of the file. ASOF_READ - Others have Read access to the file. ASOF_READWRITE - Others have Read and Write access to the file. ASOF_WRITE - Others Write access to the file. ASOF_EXCLUSIVE - Does not allow others to access the file. You
have exclusive access to the file. |
Returns:
List of file security group names if the information is retrieved successfully.
False if the file security group names can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6:
7: RichText.TextRTF = asksam.GetFileAccessGroupNames(File_Name , ASOF_READWRITE, ASOF_READWRITE)
8:
9: Set asksam = Nothing
10:
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 7 retrieves and outputs the file access group names
Line 9 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(".")
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: value = asksam.GetFileAccessGroupNames(File_Name , ASOF_READWRITE, ASOF_READWRITE)
11: Response.Write "File Path & Name= " & File_Name & "<BR>"
12: Response.Write "Groups= " & value & "<BR>"
13: Set asksam = Nothing
14: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 retrieves the file access group names
Line 12 outputs the file access group names
Line 13 frees up the memory used by the askSam instance.
Syntax:
GetAccessGroupNames
Purpose:
Retrieves the list of file security group names defined in an opened askSam file.
Returns:
List of file security group names if the information is retrieved successfully.
False if the file security group names can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetAccessGroupNames
11:
12: Else
13:
14: Error_Id = asksam.GetLastASError()
15: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
16:
17: End If
18: asksam.CloseASFile
19: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 retrieves and outputs the file access group names
Line 14 requests the error id
Line 15 requests the error string assigned to the error id
Line 18 closes the askSam file
Line 19 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetAccessGroupNames
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "<PRE><U>Access Groups</U><BR>" & value & "</PRE><BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the file access group names
Line 14 outputs the file access group names
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
GetFirstAccessGroup(supervisor_password)
Purpose:
Retrieves the first file security group name and settings defined in the askSam file.
Parameters:
|
supervisor_password |
The
file supervisor password |
Returns:
First file security group name and settings if the information is retrieved successfully.
False if the first file security group name can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim password = “a”
4: Dim asksam As Object
5:
6: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
7: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
8:
9:
If asksam.IsFileOpened
Then
10:
11: RichText.TextRTF = asksam.GetFirstAccessGroup(password)
12:
13: asksam.CloseASFile
14:
15: Else
16:
17: Error_Id = asksam.GetLastASError()
18: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
19:
20: End If
21: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable password
Line 4 defines the variable asksam
Line 6 creates an instance of the askSam database engine
Line 7 opens the askSam file
Line 9 confirms the file is open
Line 11 retrieves and outputs the first file access group name
Line 13 closes the askSam file
Line 17 requests the error id
Line 18 requests the error string assigned to the error id
Line 21 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8: password = "a"
9:
10: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
11: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
12:
13: value = asksam.GetFirstAccessGroup(password)
14: Response.Write "File Path & Name= " & File_Name & "<BR>"
15: Response.Write "First Group= " & value & "<BR>"
16:
17: asksam.CloseASFile
18: Set asksam = Nothing
19: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 8 defines the variable password
Line 10 creates an instance of the asksam database engine
Line 11 opens the askSam file
Line 13 retrieves the first file access group name
Line 15 outputs the file access group name
Line 17 closes the askSam file
Line 18 frees up the memory used by the askSam instance.
Syntax:
GetNextAccessGroup()
Purpose:
Retrieves the next file security group name and settings defined in the askSam file.
Returns:
The next file security group name and settings if the information is retrieved successfully.
0 if the next file security group name can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetNextAccessGroup
11:
12: asksam.CloseASFile
13:
14: Else
15:
16: Error_Id = asksam.GetLastASError()
17: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
18:
19: End If
20: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 retrieves and outputs the first file access group name
Line 12 closes the askSam file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id
Line 20 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetNextAccessGroup
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "Second Group= " & value & "<BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the first file access group name
Line 14 outputs the file access group name
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
GetAccessGroupReadOnly()
Purpose:
Retrieves the next file security group name and settings defined in the askSam file.
Returns:
The Next file security group name and settings if the information is retrieved successfully.
0 if the next file security group name can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetNextAccessGroup
11:
12: asksam.CloseASFile
13:
14: Else
15:
16: Error_Id = asksam.GetLastASError()
17: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
18:
19: End If
20: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 retrieves and outputs the first file access group name
Line 12 closes the askSam file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id
Line 20 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetNextAccessGroup
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "Second Group= " & value & "<BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the first file access group name
Line 14 outputs the file access group name
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
GetAccessGroupBits1()
Purpose:
Retrieves the next file security group name and settings defined in the askSam file.
Returns:
The Next file security group name and settings if the information is retrieved successfully.
0 if the next file security group name can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetNextAccessGroup
11: asksam.CloseASFile
12:
13: Else
14:
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
19: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 retrieves and outputs the first file access group name
Line 12 closes the askSam file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id
Line 20 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetNextAccessGroup
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "Second Group= " & value & "<BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the first file access group name
Line 14 outputs the file access group name
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
GetAccessGroupBits2()
Purpose:
Retrieves the next file security group name and settings defined in the askSam file.
Returns:
The Next file security group name and settings if the information is retrieved successfully.
0 if the next file security group name can not be retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.GetNextAccessGroup
11:
12: asksam.CloseASFile
13:
14: Else
15:
16: Error_Id = asksam.GetLastASError()
17: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
18:
19: End If
20: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 retrieves and outputs the first file access group name
Line 12 closes the askSam file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id
Line 20 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11:
12: value = asksam.GetNextAccessGroup
13: Response.Write "File Path & Name= " & File_Name & "<BR>"
14: Response.Write "Second Group= " & value & "<BR>"
15:
16: asksam.CloseASFile
17: Set asksam = Nothing
18: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 12 retrieves the first file access group name
Line 14 outputs the file access group name
Line 16 closes the askSam file
Line 17 frees up the memory used by the askSam instance.
Syntax:
AddAccessGroup(supervisor_password, group name,
group password)
Purpose:
Adds a new file security group name and settings in the askSam file.
Parameters:
|
supervisor_password |
The
file supervisor password |
|
group name |
The
name of the new file security group |
|
group password |
The
password for the new file security group |
Returns:
True if the group is added successfully.
False if the group can not be added. Use the GetLastAsError function for further information.
Visual Basic Example:
19: Path$ = App.Path
20: File_Name = Path$ & "\Readme.ask"
21: Dim asksam As Object
22:
23: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
24: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
25:
26: If asksam.IsFileOpened Then
27:
28: If askSam.AddAccessGroup(super,new_name,new_pass) Then
29: RichText.TextRTF = "New Group added"
30:
Else
31: RichText.TextRTF = "NOT ADDED"
32:
End If
33: asksam.CloseASFile
34:
35: Else
36:
37: Error_Id = asksam.GetLastASError()
38: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
39:
40: End If
41: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 adds the new access group
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance.
Active Server Pages Example:
42: <%@ Language=VBScript %>
43:
44: <!--#include file=“askSam.asp”-->
45:
46: <%
47: File_Path = Server.MapPath(“.”)
48: File_Name = File_Path + "\bulletin.ask"
49:
50: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
51: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
52: If asksam.IsFileOpened Then
53: If askSam.AddAccessGroup(super,new_name,new_pass) Then
54: Response.Write "New Group added<BR>"
55:
Else
56: Response.Write "NOT ADDED<BR>"
57:
End If
58: Else
59:
60: Error_Id = asksam.GetLastASError()
61: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
62:
63: End If
64: asksam.CloseASFile
65: Set asksam = Nothing
66: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 adds the new access group name
Line 14 outputs the file access group name
Line 16 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 24 frees up the memory used by the askSam instance.
Syntax:
CopyAccessGroup(supervisor_password,
group name, new group name, new group password)
Purpose:
Copies a file security group settings to a new file security group name in the askSam file. If a file security group with the same name already exists in the file the function will fail.
Parameters:
|
supervisor_password |
The
file supervisor password |
|
group name |
The
group name of the group to be copied |
|
new group name |
The
name of the new group to be created |
|
new group password |
The
password of the new group |
Returns:
True if the new group is added successfully.
False if the group can not be added. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.CopyAccessGroup(pass,name,new_name,new_pass) Then
11: RichText.TextRTF = "Copy Made "
12:
Else
13: RichText.TextRTF = "NOT COPIED"
14:
End If
15: asksam.CloseASFile
16:
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
21:
22: End If
23: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 copies the settings from the existing access group into the new access group
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: If asksam.IsFileOpened Then
12: If askSam.CopyAccessGroup(pass,name,new_name,new_pass) Then
13: Response.Write "Copy made<BR>"
14:
Else
15: Response.Write "NOT COPIED<BR>"
16:
End If
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
21:
22: End If
23: asksam.CloseASFile
24: Set asksam = Nothing
25: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 copies the settings to the new access group name
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 closes the askSam file
Line 24 frees up the memory used by the askSam instance.
Syntax:
DelAccessGroup(supervisor_password, group name
to be deleted)
Purpose:
Deletes a file security group name and settings from the askSam file.
Parameters:
|
supervisor_password |
The
file supervisor password |
|
group name to be deleted |
The
name of the file security group to delete |
Returns:
True if the group was deleted successfully.
False if the group can not be deleted. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.DelAccessGroup(password,group_name) Then
11: RichText.TextRTF = "Group deleted"
12:
Else
13: RichText.TextRTF = "Group NOT deleted"
14:
End If
15: asksam.CloseASFile
16:
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
21:
22: End If
23: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 deletes the access group
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: If asksam.IsFileOpened Then
12: If askSam.DelAccessGroup(password,group_name) Then
13: Response.Write "Group deleted<BR>"
14:
Else
15: Response.Write "Group NOT deleted<BR>"
16:
End If
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
21:
22: End If
23: asksam.CloseASFile
24: Set asksam = Nothing
25: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 deletes the access group
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 closes the askSam file
Line 24 frees up the memory used by the askSam instance.
Syntax:
RenameAccessGroup(supervisor_password,
old group name, new group name)
Purpose:
Renames a file security group name in the askSam file.
Parameters:
|
supervisor_password |
The
file supervisor password |
|
old group name |
The
current name of the Access Group |
|
new group name |
The
new name of the Access Group |
Returns:
True if the group was renamed successfully.
False if the group can not be renamed. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.RenameAccessGroup(old_name,new_name) Then
11: RichText.TextRTF = "Group renamed"
12:
Else
13: RichText.TextRTF = "Group NOT renamed"
14:
End If
15: asksam.CloseASFile
16:
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
21:
22: End If
23: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 renames the access group
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance.
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: If asksam.IsFileOpened Then
12: If askSam.RenameAccessGroup(old_name,new_name) Then
13: Response.Write "Group renamed<BR>"
14:
Else
15: Response.Write "Group NOT renamed<BR>"
16: Error_Id = asksam.GetLastASError()
17: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
18:
19:
End If
20: Else
21:
22: Error_Id = asksam.GetLastASError()
23: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
24:
25: End If
26: asksam.CloseASFile
27: Set asksam = Nothing
28: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 deletes the access group
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
AuthenticateAccessGroup(group
name, group password)
Purpose:
Verifies the password of a file security group in the askSam file.
Parameters:
|
group name |
The
access group name |
|
group password |
The
access group password |
Returns:
True if the password is correct.
False if password is not correct. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.AuthenticateAccessGroup(group_name,group_pass) Then
11: RichText.TextRTF = "Group authenticated"
12:
Else
13: RichText.TextRTF = "Group NOT authenticated"
14:
End If
15: asksam.CloseASFile
16:
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
21:
22: End If
23: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 renames the access group
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: If asksam.IsFileOpened Then
12: If askSam.AuthenticateAccessGroup(group_name,group_pass) Then
13: Response.Write "Group authenticated<BR>"
14:
Else
15: Response.Write "Group NOT authenticated <BR>"
16: Error_Id = asksam.GetLastASError()
17: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
18:
19:
End If
20: Else
21:
22: Error_Id = asksam.GetLastASError()
23: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
24:
25: End If
26: asksam.CloseASFile
27: Set asksam = Nothing
28: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 deletes the access group
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
SetAccessGroup(super_password, d)
Purpose:
Changes the settings of a file security group in the askSam file.
Parameters:
|
super_password |
The
file supervisor password |
Returns:
True if the changes are made.
False if the changes are not made. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.AuthenticateAccessGroup(groupname, grouppass)
11: asksam.CloseASFile
12:
13: Else
14:
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
19:
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8: groupname = "password"
9: grouppass = "fish"
10:
11: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
12: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
13: value = asksam.AuthenticateAccessGroup(groupname, grouppass)
14: Response.Write "File Path & Name= " & File_Name & "<BR>"
15: Response.Write "Password= " & value & "<BR>"
16:
17: asksam.CloseASFile
18:
19: %>
Syntax:
GetCurrentFileAccess(super_password,
d)
Purpose:
Returns the settings of the current file security group used to open the file.
Parameters:
|
super_password |
The
file supervisor password |
Returns:
True if the changes are made.
False if the changes are not made. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: RichText.TextRTF = asksam.AuthenticateAccessGroup(groupname, grouppass)
11: asksam.CloseASFile
12:
13: Else
14:
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8: groupname = "password"
9: grouppass = "fish"
10:
11: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
12: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
13:
14: value = asksam.AuthenticateAccessGroup(groupname, grouppass)
15: Response.Write "File Path & Name= " & File_Name & "<BR>"
16: Response.Write "Password= " & value & "<BR>"
17:
18: asksam.CloseASFile
19: %>
Syntax:
EncryptASFile(super_password)
Purpose:
Encrypts the opened askSam file. Note: The file must be opened in Exclusive mode
Parameters:
|
super_password |
The
file supervisor password |
Returns:
True if the encryption is successful.
False if the encryption is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_EXCLUSIVE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.EncryptASFile(supervisor_password) Then
11: RichText.TextRTF = "File Encrypted"
12:
Else
13: RichText.TextRTF = "File NOT encrypted"
14:
End If
15: asksam.CloseASFile
16:
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
21:
22: End If
23: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 encrypts the askSam file
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
11: If asksam.IsFileOpened Then
12: If askSam.EncryptASFile(supervisor_password) Then
13: Response.Write "File encrypted<BR>"
14:
Else
15: Response.Write "File NOT encrypted <BR>"
16: Error_Id = asksam.GetLastASError()
17: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
18:
19:
End If
20: Else
21:
22: Error_Id = asksam.GetLastASError()
23: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
24:
25: End If
26: asksam.CloseASFile
27: Set asksam = Nothing
28: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 encrypts the file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
DecryptASFile(super_password)
Purpose:
Decrypts the opened askSam file.
Parameters:
|
super_password |
The
file supervisor password |
Returns:
True if the decryption is successful.
False if the decryption is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_EXCLUSIVE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.DecryptASFile(supervisor_password) Then
11: RichText.TextRTF = "File Decrypted"
12:
Else
13: RichText.TextRTF = "File NOT Decrypted"
14:
End If
15: asksam.CloseASFile
16:
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
21:
22: End If
23: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 decrypts the askSam file
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
11: If asksam.IsFileOpened Then
12: If askSam.DecryptASFile(supervisor_password) Then
13: Response.Write "File Decrypted<BR>"
14:
Else
15: Response.Write "File NOT Decrypted <BR>"
16: Error_Id = asksam.GetLastASError()
17: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
18:
19:
End If
20: Else
21:
22: Error_Id = asksam.GetLastASError()
23: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
24:
25: End If
26: asksam.CloseASFile
27: Set asksam = Nothing
28: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 decrypts the file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance
Syntax:
IsFileEncrypted()
Purpose:
Checks if the open file is currently encrpyted.
Returns:
True if the open file is currently encrypted.
False if the open file is not currently encrypted.
Visual Basic Example:
29: Path$ = App.Path
30: File_Name = Path$ & "\Readme.ask"
31: Dim asksam As Object
32:
33: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
34: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
35:
36: If asksam.IsFileOpened Then
37:
38: If askSam.IsFileEncrypted Then
39: RichText.TextRTF = "File IS encrypted"
40:
Else
41: RichText.TextRTF = "File IS NOT encrypted"
42:
End If
43: asksam.CloseASFile
44:
45: Else
46:
47: Error_Id = asksam.GetLastASError()
48: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
49:
50: End If
51: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 determines if the file is encrypted
Line 15 closes the askSam file
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 frees up the memory used by the askSam instance
Active Server Pages Example:
52: <%@ Language=VBScript %>
53:
54: <!--#include file=“askSam.asp”-->
55:
56: <%
57: File_Path = Server.MapPath(“.”)
58: File_Name = File_Path + "\bulletin.ask"
59:
60: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
61: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
62: If asksam.IsFileOpened Then
63: If askSam.IsFileEncrypted Then
64: Response.Write "File is encrypted<BR>"
65:
Else
66: Response.Write "File IS NOT encrypted <BR>"
67:
End If
68: Else
69:
70: Error_Id = asksam.GetLastASError()
71: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
72:
73: End If
74: asksam.CloseASFile
75: Set asksam = Nothing
76: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 determines if the file is encrypted.
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 closes the askSam file
Line 24 frees up the memory used by the askSam instance.
Syntax:
ImportASW3File(asw3_filename)
Purpose:
Imports an askSam for Windows Version 3.X file into an askSam Version 4.X file.
Parameters:
|
asw3_filename |
The
askSam Version 3 filename to be imported |
Returns:
True if the import is successful.
False if the import is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
77: Path$ = App.Path
78: File_Name = Path$ & "\Readme.ask"
79: Dim asksam As Object
80:
81: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
82: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
83:
84: If asksam.IsFileOpened Then
85:
86: If askSam.ImportASW3File(file_name) Then
87: RichText.TextRTF = "File WAS imported"
88:
Else
89: RichText.TextRTF = "File WAS NOT imported"
90: Error_Id = asksam.GetLastASError()
91: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
92:
93:
End If
94: asksam.CloseASFile
95:
96: Else
97:
98: Error_Id = asksam.GetLastASError()
99: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
100:
101: End If
102: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 imports the file
Line 14 requests the error id
Line 15 requests the error string for the error id
Line 18 closes the askSam file
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 frees up the memory used by the askSam instance
Active Server Pages Example:
103: <%@ Language=VBScript %>
104:
105: <!--#include file=“askSam.asp”-->
106:
107: <%
108: File_Path = Server.MapPath(“.”)
109: File_Name = File_Path + "\bulletin.ask"
110:
111: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
112: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
113: If asksam.IsFileOpened Then
114: If askSam.ImportASW3File(file_name) Then
115: Response.Write "File was imported<BR>"
116:
Else
117: Response.Write "File WAS NOT imported <BR>"
118: Error_Id = asksam.GetLastASError()
119: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
120:
121:
End If
122: Else
123:
124: Error_Id = asksam.GetLastASError()
125: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
126:
127: End If
128: asksam.CloseASFile
129: Set asksam = Nothing
130: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 imports the file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
ImportASW3FileEx(asw3_filename,
asw3file_password)
Purpose:
Imports a passworded askSam for Windows Version 3.X file into an askSam Version 4.X file. (requires the Version 3 askSam Edit password to gain access to the file. )
Parameters:
|
asw3_filename |
The
askSam Version 3 filename to be imported |
|
asw3file_password |
The
edit password for the askSam version 3 file |
Returns:
True if the import is successful.
False if the import is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
131: Path$ = App.Path
132: File_Name = Path$ & "\Readme.ask"
133: Dim asksam As Object
134:
135: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
136: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
137:
138: If asksam.IsFileOpened Then
139:
140: If askSam.ImportASW3FileEx(file_name,file_password) Then
141: RichText.TextRTF = "File WAS imported"
142:
Else
143: RichText.TextRTF = "File WAS NOT imported"
144: Error_Id = asksam.GetLastASError()
145: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
146:
147:
End If
148: asksam.CloseASFile
149:
150: Else
151:
152: Error_Id = asksam.GetLastASError()
153: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
154:
155: End If
156: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 imports the file
Line 14 requests the error id
Line 15 requests the error string for the error id
Line 18 closes the askSam file
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 frees up the memory used by the askSam instance
Active Server Pages Example:
157: <%@ Language=VBScript %>
158:
159: <!--#include file=“askSam.asp”-->
160:
161: <%
162: File_Path = Server.MapPath(“.”)
163: File_Name = File_Path + "\bulletin.ask"
164:
165: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
166: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
167: If asksam.IsFileOpened Then
168: If askSam.ImportASW3FileEx(file_name,file_password) Then
169: Response.Write "File was imported<BR>"
170:
Else
171: Response.Write "File WAS NOT imported <BR>"
172: Error_Id = asksam.GetLastASError()
173: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
174:
175:
End If
176: Else
177:
178: Error_Id = asksam.GetLastASError()
179: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
180:
181: End If
182: asksam.CloseASFile
183: Set asksam = Nothing
184: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 imports the file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
GetASW3ImportStatus( )
Purpose:
Reports the status of an askSam 3 Import process.
Returns:
True if the import is successful.
False if the import is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileEncrypted
Then
9:
10: RichText.TextRTF = “The file is encrypted.”
11:
12: Else
13:
14: RichText.TextRTF = “The file is NOT encrypted.”
15:
16: End If
17:
18: asksam.CloseASFile
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: value = asksam.IsFileEncrypted
12: Response.Write "File Path & Name= " & File_Name & "<BR>"
13:
14: If value = True Then
15:
16: Response.Write "The file is encrypted.<BR>"
17:
18: Else
19:
20: Response.Write "The file is NOT encrypted.<BR>"
21:
22: End If
23:
24: asksam.CloseASFile
25: %>
Syntax:
ImportASW3Cancel( )
Purpose:
Cancels the current askSam Version 3 import.
Returns:
True if the import is successful.
False if the import is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IsFileEncrypted
Then
9:
10: RichText.TextRTF = “The file is encrypted.”
11:
12: Else
13:
14: RichText.TextRTF = “The file is NOT encrypted.”
15:
16: End If
17:
18: asksam.CloseASFile
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: value = asksam.IsFileEncrypted
12: Response.Write "File Path & Name= " & File_Name & "<BR>"
13:
14: If value = True Then
15:
16: Response.Write "The file is encrypted.<BR>"
17:
18: Else
19:
20: Response.Write "The file is NOT encrypted.<BR>"
21:
22: End If
23:
24: asksam.CloseASFile
25: %>
Syntax:
IndexFile( )
Purpose:
Indexes the current askSam File
Returns:
True if the index creation is successful.
False if the index creation is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
26: Path$ = App.Path
27: File_Name = Path$ & "\Readme.ask"
28: Dim asksam As Object
29:
30: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
31: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
32:
33: If asksam.IsFileOpened Then
34:
35: If askSam.IndexFile Then
36: RichText.TextRTF = "File indexed"
37:
Else
38: RichText.TextRTF = "File WAS NOT indexed"
39: Error_Id = asksam.GetLastASError()
40: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
41:
42:
End If
43: asksam.CloseASFile
44:
45: Else
46:
47: Error_Id = asksam.GetLastASError()
48: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
49:
50: End If
51: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 indexes the file
Line 14 requests the error id
Line 15 requests the error string for the error id
Line 18 closes the askSam file
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 frees up the memory used by the askSam instance
Active Server Pages Example:
52: <%@ Language=VBScript %>
53:
54: <!--#include file=“askSam.asp”-->
55:
56: <%
57: File_Path = Server.MapPath(“.”)
58: File_Name = File_Path + "\bulletin.ask"
59:
60: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
61: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
62: If asksam.IsFileOpened Then
63: If askSam.IndexFile Then
64: Response.Write "File indexed<BR>"
65:
Else
66: Response.Write "File WAS NOT indexed <BR>"
67: Error_Id = asksam.GetLastASError()
68: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
69:
70:
End If
71: Else
72:
73: Error_Id = asksam.GetLastASError()
74: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
75:
76: End If
77: asksam.CloseASFile
78: Set asksam = Nothing
79: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 indexes the file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
GetIndexStatus( )
Purpose:
Gets the status of a file indexing process.
Returns:
True if the information retrieval is successful.
False if the information retrieval is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IndexFile
Then
9:
10: RichText.TextRTF = “The file was indexed successfully.”
11:
12: Else
13:
14: RichText.TextRTF = “The file was NOT indexed successfully.”
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
19:
20: asksam.CloseASFile
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\indexme.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: value = asksam.IndexFile
12: Response.Write "File Path & Name= " & File_Name & "<BR>"
13:
14: If value = True Then
15:
16: Response.Write "The file was indexed successfully.<BR>"
17:
18: Else
19:
20: Response.Write "The file as NOT indexed successfully.<BR>"
21: Error_Id = asksam.GetLastASError()
22: Text = asksam.ASErrorToString(Error_Id)
23: Response.Write "<CENTER> The following error occurred: <P>"
24: Response.Write Text
25: Response.Write "</CENTER>"
26:
27: End If
28:
29: asksam.CloseASFile
30: %>
Syntax:
GetIndexStatistics( )
Purpose:
Returns the statistics of the file indexing process after the index is completed.
Returns:
True if the information retrieval is successful.
False if the information retrieval is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READ, ASOF_READWRITE
7:
8:
If asksam.IndexFile
Then
9:
10: RichText.TextRTF = “The file was indexed successfully.”
11:
12: Else
13:
14: RichText.TextRTF = “The file was NOT indexed successfully.”
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
19:
20: asksam.CloseASFile
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\indexme.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: value = asksam.IndexFile
12: Response.Write "File Path & Name= " & File_Name & "<BR>"
13:
14: If value = True Then
15:
16: Response.Write "The file was indexed successfully.<BR>"
17:
18: Else
19:
20: Response.Write "The file as NOT indexed successfully.<BR>"
21: Error_Id = asksam.GetLastASError()
22: Text = asksam.ASErrorToString(Error_Id)
23: Response.Write "<CENTER> The following error occurred: <P>"
24: Response.Write Text
25: Response.Write "</CENTER>"
26:
27: End If
28:
29: asksam.CloseASFile
30: %>
Syntax:
IndexCancel( )
Purpose:
Cancels the current file indexing process. Must be called from the same Object that initiated the index procedure. Must be called from another thread than the thread indexing the file.
Returns:
True if the index cancellation is successful.
False if the index cancellation is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.IndexCancel Then
11: RichText.TextRTF = "Index was cancelled"
12:
Else
13: RichText.TextRTF = "Index WAS NOT cancelled"
14: Error_Id = asksam.GetLastASError()
15: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
16:
17:
End If
18: asksam.CloseASFile
19:
20: Else
21:
22: Error_Id = asksam.GetLastASError()
23: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
24:
25: End If
26: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 cancels the index
Line 14 requests the error id
Line 15 requests the error string for the error id
Line 18 closes the askSam file
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 frees up the memory used by the askSam instance
Active Server Pages Example:
27: <%@ Language=VBScript %>
28:
29: <!--#include file=“askSam.asp”-->
30:
31: <%
32: File_Path = Server.MapPath(“.”)
33: File_Name = File_Path + "\bulletin.ask"
34:
35: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
36: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
37: If asksam.IsFileOpened Then
38: If askSam.IndexCancel Then
39: Response.Write "Index cancelled<BR>"
40:
Else
41: Response.Write "Index WAS NOT cancelled <BR>"
42: Error_Id = asksam.GetLastASError()
43: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
44:
45:
End If
46: Else
47:
48: Error_Id = asksam.GetLastASError()
49: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
50:
51: End If
52: asksam.CloseASFile
53: Set asksam = Nothing
54: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 cancels the index
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
IsFileIndexed()
Purpose:
Determines if the file is currently indexed or not.
Returns:
True if the file is currently indexed.
False if the file is not currently indexed.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
7:
8:
If asksam.IsFileOpened
Then
9:
10: If askSam.IsFileIndexed Then
11: RichText.TextRTF = "File is indexed"
12:
Else
13: RichText.TextRTF = "File IS NOT indexed"
14:
End If
15:
16: asksam.CloseASFile
17:
18: Else
19:
20: Error_Id = asksam.GetLastASError()
21: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
22:
23: End If
24: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 determines if the file is indexed
Line 16 closes the askSam file
Line 20 requests the error id
Line 21 requests the error string assigned to the error id and outputs it to the screen
Line 24 frees up the memory used by the askSam instance
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
11: If asksam.IsFileOpened Then
12: If askSam.IsFileIndexed Then
13: Response.Write "File is indexed<BR>"
14:
Else
15: Response.Write "File IS NOT indexed <BR>"
16:
End If
17: Else
18:
19: Error_Id = asksam.GetLastASError()
20: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
21:
22: End If
23: asksam.CloseASFile
24: Set asksam = Nothing
25: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 cancels the index
Line 19 requests the error id
Line 20 requests the error string assigned to the error id and outputs it to the screen
Line 23 closes the askSam file
Line 24 frees up the memory used by the askSam instance.
Syntax:
DeleteIndex( )
Purpose:
Deletes the index from the open askSam file.
Returns:
True if the index was deleted successfully.
False if the index was not deleted successfully.
Visual Basic Example:
26: Path$ = App.Path
27: File_Name = Path$ & "\Readme.ask"
28: Dim asksam As Object
29:
30: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
31: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
32:
33: If asksam.IsFileOpened Then
34:
35: If askSam.DeleteIndex Then
36: RichText.TextRTF = "Index was deleted"
37:
Else
38: RichText.TextRTF = "Index WAS NOT deleted"
39: Error_Id = asksam.GetLastASError()
40: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
41:
42:
End If
43: asksam.CloseASFile
44:
45: Else
46:
47: Error_Id = asksam.GetLastASError()
48: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
49:
50: End If
51: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 deletes the index
Line 14 requests the error id
Line 15 requests the error string for the error id
Line 18 closes the askSam file
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 frees up the memory used by the askSam instance
Active Server Pages Example:
52: <%@ Language=VBScript %>
53:
54: <!--#include file=“askSam.asp”-->
55:
56: <%
57: File_Path = Server.MapPath(“.”)
58: File_Name = File_Path + "\bulletin.ask"
59:
60: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
61: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_READWRITE
62: If asksam.IsFileOpened Then
63: If askSam.DeleteIndex Then
64: Response.Write "Index deleted<BR>"
65:
Else
66: Response.Write "Index WAS NOT deleted <BR>"
67: Error_Id = asksam.GetLastASError()
68: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
69:
70:
End If
71: Else
72:
73: Error_Id = asksam.GetLastASError()
74: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
75:
76: End If
77: asksam.CloseASFile
78: Set asksam = Nothing
79: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 deletes the index
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
PackFile( )
Purpose:
Packs the current askSam File
Returns:
True if the pack is successful.
False if the pack is not successful. Use the GetLastAsError function for further information.
Visual Basic Example:
80: Path$ = App.Path
81: File_Name = Path$ & "\Readme.ask"
82: Dim asksam As Object
83:
84: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
85: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
86:
87: If asksam.IsFileOpened Then
88:
89: If askSam.PackFile Then
90: RichText.TextRTF = "File was packed"
91:
Else
92: RichText.TextRTF = "File WAS NOT packed"
93: Error_Id = asksam.GetLastASError()
94: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
95:
96:
End If
97: asksam.CloseASFile
98:
99: Else
100:
101: Error_Id = asksam.GetLastASError()
102: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
103:
104: End If
105: Set asksam = Nothing
Line 1 defines the pathway to the askSam file
Line 2 defines the filename and appends it to the pathway
Line 3 defines the variable asksam
Line 5 creates an instance of the askSam database engine
Line 6 opens the askSam file
Line 8 confirms the file is open
Line 10 packs the file
Line 14 requests the error id
Line 15 requests the error string for the error id
Line 18 closes the askSam file
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 frees up the memory used by the askSam instance
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\bulletin.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
11: If asksam.IsFileOpened Then
12: If askSam.PackFile Then
13: Response.Write "File was packed<BR>"
14:
Else
15: Response.Write "File WAS NOT packed <BR>"
16: Error_Id = asksam.GetLastASError()
17: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
18:
19:
End If
20: Else
21:
22: Error_Id = asksam.GetLastASError()
23: Response.Write "Error: " & asksam.ASErrorToString(Error_Id)
24:
25: End If
26: asksam.CloseASFile
27: Set asksam = Nothing
28: %>
Line 1 defines VBScript as the default scripting language for this page
Line 3 includes the default askSam constants
Line 6 defines the pathway
Line 7 defines the filename and appends it to the pathway
Line 9 creates an instance of the asksam database engine
Line 10 opens the askSam file
Line 11 confirms the file is open
Line 12 packs the file
Line 16 requests the error id
Line 17 requests the error string assigned to the error id and outputs it to the screen
Line 22 requests the error id
Line 23 requests the error string assigned to the error id and outputs it to the screen
Line 26 closes the askSam file
Line 27 frees up the memory used by the askSam instance.
Syntax:
GetPackStatus( )
Purpose:
Reports on the status of a packing process. Must be called from the same Object that initiated the pack.
Returns:
True if the status is retrieved.
False if the status is not retrieved. Use the GetLastAsError function for further information.
Visual Basic Example:
1: Path$ = App.Path
2: File_Name = Path$ & "\Readme.ask"
3: Dim asksam As Object
4:
5: Set asksam = CreateObject(“ASKSAM.EngineCtrl.5”)
6: asksam.OpenASFile File_Name, ASOF_READWRITE, ASOF_EXCLUSIVE
7:
8:
If asksam.PackFile
Then
9:
10: RichText.TextRTF = “The file was packed successfully.”
11:
12: Else
13:
14: RichText.TextRTF = “The file was NOT packed successfully.”
15: Error_Id = asksam.GetLastASError()
16: RichText.TextRTF = asksam.ASErrorToString(Error_Id)
17:
18: End If
19:
20: asksam.CloseASFile
21:
Active Server Pages Example:
1: <%@ Language=VBScript %>
2:
3: <!--#include file=“askSam.asp”-->
4:
5: <%
6: File_Path = Server.MapPath(“.”)
7: File_Name = File_Path + "\indexme.ask"
8:
9: Set asksam = Server.CreateObject(“ASKSAM.EngineCtrl.5”)
10: as