Table of Contents.
        Introduction
                  Overview
                  Screen Modes
        Installation
                  Copy the folder
                  Test your installation
        Methods
                  VbsDbNew
                  VbsDb
                  VbsDbClose
                  VbsDbGetOutputFieldValue
                  VbsDbGetDateFormat
                  VbsDbGetScreenType
                  VbsDbGetLastAction
        Properties
                  Global Properties
                           Dsn
                           MdbPath
                           Sql
                           GlobalId
                           GlobalDbType
                           GlobalStartScreen
                           GlobalFieldHeaders
                           GlobalTableBGColor
                           GlobalTableFGColor
                           GlobalHeaderBGColor
                           GlobalHeaderFGColor
                           GlobalImageDir
                           GlobalLanguage
                           GlobalCustomText
                           GlobalReset
                           GlobalCSS
                           GlobalSeparators
                           GlobalQuerystringPreserve
                           GlobalOleDbProvider
                           GlobalPagePositioning
                  View screen properties
                           General view screen properties
                                     ViewMode
                                     ViewNavigationButtons
                                     ViewNavigationPosition
                                     ViewNavigationBGColor
                                     ViewNavigationFGColor
                                     ViewNavigationDisabledFGColor
                                     ViewPosition
                                     ViewFieldFormats
                           Grid related view screen properties
                                     GridFields
                                     GridHideFields
                                     GridShowIndex
                                     GridTableTag
                                     GridPageSize
                                     GridHorizontalStripeBGColor
                                     GridSelectedIndexBGColor
                                     GridSelectedIndexFGColor
                                     GridUnselectedIndexFGColor
                                     GridDeleteButtons
                                     GridUpdateButtons
                                     GridTemplate
                           Form related view screen properties
                                     FormFields
                                     FormHideFields
                                     FormTableTag
                                     FormTemplate
                                     FormExactAfterEdit
                  Input screen properties
                           General input screen properties
                                     InputEnumeratedFields
                                     InputPasswordFields
                                     InputSelectFields
                                     InputValidateDateFields
                           Search screen properties
                                     SearchFields
                                     SearchHideFields
                                     SearchAliasFields
                                     SearchOperators
                                     SearchScreenRepeat
                                     SearchTemplate
                           Edit screen properties
                                     EditTableName
                                     EditKeyFields
                                     EditFields
                                     EditHideFields
                                     EditReadOnlyFields
                                     EditAddFieldDefaults
                                     EditUpdateFieldDefaults
                                     EditAddSingle
                                     EditAddScreenRepeat
                                     EditValidateRequiredFields
                                     EditValidateRegExp
                                     EditErrorMessages
                                     EditMemoFields
                                     EditAddTemplate
                                     EditUpdateTemplate
                                     EditDeleteTemplate
                                     EditAutoincrement
                                     EditFormTamperingControl
Introduction.
VBSdb is an open source VBScript object for fast development of complete database driven web applications, to be invoked within Active Server Pages.

Overview
There are many components for developing database based web applications. But these tools require a dll installation on the server side: once the installation is performed, a new object can be instantiated, allowing the developer to define some properties and then call some methods, to display database data and to edit such data.
Such approach has some clear drawbacks. Firs of all, a new software component (the COM object) is to be installed on the server. This is not always an easy operation and, more important, most hosting services don't allow the single developer to install custom software.
Furthermore, such a component is delivered "as is": no source code is available, and then, customization is impossible.

VBSdb solves these (and other) problems. VBSdb consists of a single folder, containing a set of pure vbscript code files, which can be run with both ASP 2.0 and ASP 3.0. Nothing has to be installed! Just copy the VBSdb folder in your site!! Then, in each file where you want to use VBSdb, you need just a single include statement, and all VBSdb properties and methods are available!!!
We decided to use the VBScript version supported by ASP 2.0. This language is not object oriented (from this point of view, VBScript for ASP 3.0 is definetely better), but we succeded in simulating an object oriented framework, by means of extensive use of the dictionary object datatype (fully supported in ASP 2.0). As a result, a VBSdb user simply assigns properties (values associated to a VBSdb dictionary object) and then calls a method of the VBSdb object (a VBScript procedure, passing the dictionary object as a parameter).

So, VBSdb can be used both with Microsoft Internet Information Server 4.0 and with IIS 5.0. Even if many hosting service have not yet updated their servers to IIS 5.0, we are giving virtually all ASP developers the chance to use an object oriented tool, for fast database based web development.
Furthermore, VBSdb's code is open source. We believe our software is higly customizable, and it will be more in the near future, but users can freely modify the code to fit their needs. Consider that you can make a full copy of the VBSdb directory, customize the copy's VBScript and then, in some pages use the customized copy, while in the other pages, keep using the official VBSdb version.

Screen Modes
Accessing to a VBSdb web page, the user can navigate among many different screens. We can divide such screens in two main categories: view screens and input screens.

View screens display recordset data. The developer choses if such data are to be shown in a grid or they must be accessed one single record in each screen, in a (read only) form like layout.
Furthermore, mixed view screens are supported.

When each record structure contains many fields, it would be impractical to show all fields in each grid row. In such cases, the best solution may be to dispaly a subset of key fields in grid mode, giving the user the chance to click on a row, and see the corresponding record in a detailed form view, thus allowing the user to access, in a single screen, both to a record set grid and to a single record detail.

Input screens wait for input from the user. They can be further categorized, distinguishing them in a single search screen and three different edit screens: the add screen, the update screen and the delete screen.

This chart shows the screen type hierarchy. Note that View Screens can be further subdivided in Grid screens, Form Screens and Mixed View Screens (showing both the grid and the form objects).

In order to help the developer to find the proper property to get a wanted effect, property names have been properly prefixed. If a property name begins with Grid, then the property value affects the behaviour of the grid in the view screen. The following table summarizes, for each property group, the scope of the properties belonging to the group.

Properties beginning with: Influence:
Grid Grid in view screen mode
Form Form in view screen mode
View View screen mode, neither just to the grid, nor just to the form
Search Search screen mode
Edit Both Add screen and Update screen and Delete screen
Input Both the Search screen and the Add screen and the Update screen and the Delete screen
Global Every screen
Note: MdbPath and Sql properties have not been prefixed, in order to distinguish them from the others, as they are the only two required properties (Dsn may be used instead of MdbPath).

Installation.
To install VBSdb, you just have to unzip a zip file and to copy a folder in your web application. That's all.
You should have downloaded a VBSdb zip file. Its name should look something like VBSdb-mainVersionNumber-subVersionNumber.zip
It contains three files and and two folders. The three files are test.asp, test.mdb and documentation.htm. test.asp and test.mdb will be used to check your installation is correct, documentation.htm is the file you are reading now, if you are off line.
The first folder, named documentation, contains all the layout files and images needed to build the documentation you are reading now. Do not consider it at all. The second folder called VBSdb, contains a number of asp files: it is the VBSdb module, implementing VBSdb properties and methods. This is the folder you will have to copy in your web application.

You have to unzip the VBSdb zip file on your PC. We suggest to chose an empty folder. If not available, you should create it. Let's assume your empty folder complete path is c:\unzipVBSdb\
Extract all the files in c:\unzipVBSdb\ (or chose the empty folder you have previously decided). Now, two new folders should have been created, c:\unzipVBSdb\VBSdb\ and c:\unzipVBSdb\documentation\. Furthermore, you have the files c:\unzipVBSdb\test.asp, c:\unzipVBSdb\test.mdb and c:\unzipVBSdb\documentation.htm.

Copy The Folder
Now, you have to copy the c:\unzipVBSdb\VBSdb\ folder in the site where you want to use VBSdb. Let's assume you have defined a TestVBSdb site, whose home directory is c:\inetpub\testVBSdb\
Copy the c:\unzipVBSdb\VBSdb\ folder under c:\inetpub\testVBSdb\. You now have a new c:\inetpub\testVBSdb\VBSdb\ folder and the installation can be considered completed.

Test your installation
Copy c:\unzipVBSdb\test.asp and c:\unzipVBSdb\test.mdb in the c:\inetpub\testVBSdb\ folder. Now, connect to your testVBSdb site and open in your browser the test.asp file (depending on your system, and your site configuration, your browser address may vary: an address example may be http://testVBSdb/test.asp; an other example may be http://localhost/testVBSdb/test.asp or http://127.0.0.1/test.asp). If the browser shows a page allowing the user to browse data, installation is correct.

Methods
In this section, VBSdb methods are described. For each method a short description is presented. Then syntax is defined and usage examples are provided. An extensive description follows and, finally, a complete working program illustrates how to use the method. If not otherwise stated, such programs connect to the Microsoft sample nwind.mdb database (the names of companies, products, people, characters, and/or data mentioned herein are fictious and are in no way intended to represent any real individual, company, product, or event). On the contrary, syntax examples, are not related to any real database.

Method List
 VbsDbNew 
Creates a new VBSdb object.
Syntax
VbsDbNew variable name
Examples:
VbsDbNew objVbsDb
VbsDbNew VBSdbObject
Description
Use VbsDbNew to create a new VBSdb object. This procedure call acts as an object constructor: it returns a VBSdb object with assigned default values.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   VbsDb objVbsDb
   VbsDbClose objVbsDb
%>
On Line Example
A live example of this property can be found here.
 VbsDb 
Execute the VBSdb object.
Syntax
VbsDb variable name
Examples:
VbsDb objVbsDb
VbsDb VBSdbObject
Description
Use VbsDb to perform each action associated to the VBSdb object. This procedure call acts as an object method applied to the object that is passed as a parameter. The type of actions actually performed, depends on the last user command. If it is the first time the method is called, then the view screen is displayed. If we are coming back to the page after a VBSdb command has been executed, then the action performed depends upon the last command given by the site user:
  • assume current screen is in view mode
    • if a grid index was pressed, then the next screen is still the view screen, and the selected record will be displayed in the form (database is left unchanged)
    • if a navigation button is pressed, then the the next screen is still the view screen, and the displayed screen mode will be the selected one. If first, prev, next or last is selected, then the selected page of grid data is displayed (database is left unchanged)
    • if a grid update button is pressed, then the next screen will be an update screen and the record to be update will be that associated to the update button that was clicked (database is left unchanged)
    • if a grid update button is pressed, then the next screen will be an update screen and the record to be updated will be that associated to the update button that was clicked (database is left unchanged)
    • if a grid delete button is pressed, then the next screen will be an delete screen and the record to be deleted will be that associated to the delete button that was clicked (database is left unchanged)
  • assume current screen is in input mode
    • if the screen is of search type and the form is submitted, then the next screen will be in view mode (database is left unchanged)
    • if the screen is of update type and the form is submitted, then the database record is updated and the next screen will be in view mode
    • if the screen is of delete type and the form is submitted, then the database record is deleted and the next screen will be in view mode
    • if the screen is of add type and the form is submitted, then the new database record is added and the next screen will be in view mode
    • whenever a cancel button is pressed, the next screen will be in view mode (database is left unchanged)
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   VbsDb objVbsDb
   VbsDbClose objVbsDb
%>
On Line Example
A live example of this property can be found here.
 VbsDbClose 
Releases a VBSdb object.
Syntax
VbsDbClose variable name
Examples:
VbsDbClose objVbsDb
VbsDbClose VBSdbObject
Description
Use VbsDbClose to destroy a VBSdb object and to collect garbage data. In following examples, VbsDbClose call is omitted for clarity, but its use is strongly recommended, since it gives the server more available memory space.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   VbsDb objVbsDb
   VbsDbClose objVbsDb
%>
On Line Example
A live example of this property can be found here.
 VbsDbGetOutputFieldValue 
Returns a field value of the selected grid record.
Syntax
variable name = VbsDbGetOutputFieldValue( field name , VBSdb object )
Examples:
strFirstName = VbsDbGetOutputFieldValue( "FirstName" , objVbsDb)
intUnitsInStock = VbsDbGetOutputFieldValue( "UnitsInStock" , objVbsDb)
Description
Use VbsDbGetOutputFieldValue to get a fiel value for the selected grid record. It must be used after the VbsDb method is called and before the VbsDbClose method is called. It is extremely useful to build table/subtable scenarios.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDbOrders    objVbsDbOrders( "GlobalId" ) = "Orders"
   objVbsDbOrders( "MdbPath" ) = "data/nwind.mdb"
   objVbsDbOrders( "Sql" ) = "select * from Orders"
   objVbsDbOrders( "ViewMode" ) = "Grid"
   objVbsDbOrders( "ViewNavigationPosition" ) = "Top"
   objVbsDbOrders( "GridFields" ) = "OrderId;OrderDate"
   VbsDb objVbsDbOrders
   lngOrderId = VbsDbGetOutputFieldValue( "OrderId" , objVbsDbOrders )
   VbsDbClose objVbsDbOrders

   VbsDbNew objVbsDbOrderDetails
   objVbsDbOrderDetails( "GlobalId" ) = "OrderDetails"
   objVbsDbOrderDetails( "MdbPath" ) = "data/nwind.mdb"
   objVbsDbOrderDetails( "Sql" ) = "select * from [Order Details] where OrderId=" & lngOrderId
   objVbsDbOrderDetails( "GridShowIndex" ) = false
   objVbsDbOrderDetails( "GridUpdateButtons" ) = true
   objVbsDbOrderDetails( "GridDeleteButtons" ) = true
   objVbsDbOrderDetails( "ViewMode" ) = "Grid"
   objVbsDbOrderDetails( "ViewNavigationButtons" ) = "first;prev;next;last;search;add"
   objVbsDbOrderDetails( "InputSelectFields" ) = "ProductID|select ProductID,ProductName from Products "
                                                                                        "order by ProductName"
   objVbsDbOrderDetails( "EditTableName" ) = "Order Details"
   objVbsDbOrderDetails( "EditKeyFields" ) = "OrderID;ProductID"
   objVbsDbOrderDetails( "EditAddFieldDefaults" ) = "OrderID|" & lngOrderId
   objVbsDbOrderDetails( "EditReadOnlyFields" ) = "OrderID"
   objVbsDbOrderDetails( "EditHideFields" ) = "Discount"
   objVbsDbOrderDetails( "EditValidateRequiredFields" ) = "ProductID|ProductID is required.;UnitPrice|UnitPrice is " & _                                                                                                           "required.;Quantity|Quantity is required."
   objVbsDbOrderDetails( "GlobalImageDir" ) = "VBSdb/images"
   VbsDb objVbsDbOrderDetails
%>
On Line Example
A live example of this property can be found here.
 VbsDbGetDateFormat 
Returns the current recognized date format.
Syntax
variable name = VbsDbGetDateFormat( VBSdb object ) (returns a string value)
Example:
strFirstName = VbsDbGetDateFormat( objVbsDb )
Description
VbsDbGetDateFormat returns a string, containing a description of the correct date format according to the current session.lcid value. You can use this method to display it to your site user, giving an hint about how to insert date field values. Of course, you can decide the accepted format, by properly setting the session.lcid value.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   session.lcid = 1033
   VbsDbNew objVbsDb
   strDateFormat = VbsDbGetDateFormat( objVbsDb )
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,BirthDate from Employees"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "EditAddFieldDefaults" ) = "LastName|MyLastName;FirstName|MyName;BirthDate|Not a date!"
   objVbsDb( "InputValidateDateFields" ) = "BirthDate|BirthDate is not a valid date (date format is '" & _
                                                              "strDateFormat & "')"
   objVbsDb( "GlobalFieldHeaders" ) = "BirthDate|BirthDate ('" & strDateFormat & "')"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 VbsDbGetScreenType 
Returns a string identifying the current screen type.
Syntax
variable name = VbsDbGetScreenType( VBSdb object )
Examples:
strScreenType = VbsDbGetScreenType( objVbsDb)
if VbsDbGetScreenType( objVbsDb)="View" then
Description
Use VbsDbGetScreenType to know which is the current screen type. Possible return values are:
  • View: current is a View screen
  • Search: current is a Search screen
  • Add: current is an Add screen
  • Update: current is an Update screen
  • Delete: current is a Delete screen
Use this method, for example, to avoid displaying subtables when not in View mode.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
   response.write "<p>Current screen type is a <b>" & VbsDbGetScreenType( objVbsDb ) & "</b>"
   VbsDb objVbsDb
   VbsDbClose objVbsDb
%>
On Line Example
A live example of this property can be found here.
 VbsDbGetLastAction 
Returns a string identifying the last action performed by the site visitor.
Syntax
variable name = VbsDbGetLastAction( VBSdb object )
Examples:
strLastAction = VbsDbGetLastAction( objVbsDb )
response.write VbsDbGetLastAction( objVbsDb )
Description
Use VbsDbGetLastAction to know which was the last action asked by the site visitor. Possible return values are:
  • NonVbsDb: the last visitor action was not related to the VBSdb object
  • GoToGridRow: the visitor asked to go to a specific Grid row
  • GoToFirstGridPage: the visitor asked to go to the first page in the Grid
  • GoToLastGridPage: the visitor asked to go to the last page in the Grid
  • GoToPrevGridPage: the visitor asked to go to the previous page in the Grid
  • GoToNextGridPage: the visitor asked to go to the next page in the Grid
  • GoToSearch: the visitor asked to go to the Search screen
  • RemoveFilter: the visitor asked to clear the applied filter
  • GoToAdd: the visitor asked to go to the Add screen
  • GoToUpdate: the visitor asked to go to the Update screen
  • GoToDelete: the visitor asked to go to the Delete screen
  • Cancel: the visitor asked to cancel the input task
  • SubmitSearch: the visitor submitted a new filter condition
  • SubmitAdd: the visitor submitted a new record to be inserted
  • SubmitUpdate: the visitor submitted new values to update the current record with
  • SubmitDelete: the visitor confirmed to delete the current record
Use this method, for example, to perform some task when a new record is added.

VbsDbGetLastAction can be invoked after having called the VbsDbNew method. If you assign a custom value to the GlobalId property, VbsDbGetLastAction must be called after the GlobalId assignment.

Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
   VbsDb objVbsDb
   strLastAction = VbsDbGetLastAction( objVbsDb )
   VbsDbClose objVbsDb
   response.write "Last action was <b>" & strLastAction & "</b>."
%>
On Line Example
A live example of this property can be found here.

Properties
In this section, VBSdb properties are described. For each property a short description is presented. Then syntax is defined and assignment examples are provided. An extensive description follows and, finally, a complete working program illustrates how to use the property. If not otherwise stated, such programs connect to the Microsoft sample nwind.mdb database (the names of companies, products, people, characters, and/or data mentioned herein are fictious and are in no way intended to represent any real individual, company, product, or event). On the contrary, syntax examples, are not related to any real database.
Property List
 Dsn 
Set an odbc datasource name.
Syntax
objVBSdb("Dsn") = connection string
Examples:
objVBSdb("Dsn") = "nwind"
objVBSdb("Dsn") = "DSN=mySource;UID=sa;Password=mypass"
Description
Dsn property is used to identify an odbc datasource. VBSdb will connect to the corresponding database.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "Dsn" ) = "nwind"
   objVbsDb( "Sql" ) = "select * from products"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 MdbPath 
If your datasource is a MS Access database, then set MdbPath to the virtual path to the .mdb file.
Syntax
objVBSdb("MdbPath") = "virtual path to the .mdb database"
Examples:
objVBSdb("MdbPath") = "../data/nwind.mdb"
objVBSdb("MdbPath") = "/data/nwind.mdb"
Description
You have to assign the virtual path, from the asp page where you are using VBSdb, to the mdb database. Both absolute and relative path can be used. VBSdb translates your virtual path to the physical path of your database.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 Sql 
Set the sql query for recordset browsing.
Syntax
objVBSdb("Sql") = string (a valid sql statement)
Examples:
objVBSdb("Sql") = "select * from Suppliers"
objVBSdb("Sql") = "select ProductId,ProductName from Products"
Description
Sql is a mandatory property. It tells to VBSdb which is the recordset to be retrieved for browsing.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Suppliers inner join Products " & _
                                  "on Suppliers.SupplierID = Products.SupplierID"

   objVbsDb( "GridFields" ) = "ProductName;CompanyName"
   objVbsDb( "FormFields" ) = "CompanyName;ProductName;UnitPrice"
%>
On Line Example
A live example of this property can be found here.
 GlobalId 
Identifies a VBSdb object in a page.
Syntax
objVBSdb("GlobalId") = variant
Examples:
objVBSdb("GlobalId") = "products"
objVBSdb("GlobalId") = 123
Description
If you use two or more VBSdb objects in a page, you have to assign an identifier to each object. It allows VBSdb modules to discriminate among different input requests and different session variables.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb1
   objVbsDb1( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb1( "Sql" ) = "select ProductName,UnitPrice,UnitsInStock from products"
   objVbsDb1( "GlobalId" ) = 1
   VbsDb objVbsDb1

   VbsDbNew objVbsDb2
   objVbsDb2( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb2( "Sql" ) = "select ProductName,UnitPrice,UnitsInStock from products"
   objVbsDb2( "GlobalId" ) = 2
   VbsDb objVbsDb2
%>
On Line Example
A live example of this property can be found here.
 GlobalDbType 
Identifies the database type.
Syntax
objVBSdb("GlobalDbType") = string. Accepted values are "Access" (default), "SqlServer", "FoxPro", "Oracle", "MySql", "Other" (case insensitive)
Examples:
objVBSdb("GlobalDbType") = "SqlServer"
objVBSdb("GlobalDbType") = "Oracle"
Description
This property is used to handle ado related database peculiarities. For example, it determines date constant formats ('#' delimiter is used for Access, while '{' and '}' is used for Fox Pro).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "Dsn" ) = "DSN=pubs;uid=sa;pwd=;database=pubs"
   objVbsDb( "GlobalDbType" ) = "SqlServer"
   objVbsDb( "Sql" ) = "select * from authors"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalStartScreen 
Determines the type for the first displayed screen.
Syntax
objVBSdb("GlobalStartScreen") = string. Accepted values are "view", "search", "add" (case insensitive). Default is "view".
Examples:
objVBSdb("GlobalStartScreen") = "search"
objVBSdb("GlobalStartScreen") = "add"
Description
If you want the user to begin filtering the data do be shown, then you can set GlobalStartScreen to 'search'.
In many application it is typical to provide the user with an 'Add New' menu item: if the user wants to add a new record, it is better to directly display an add new record form. To get such result, you have simply to set GlobalStartScreen to 'add'. When you set GlobalStartScreen to 'add', often you will also set EditAddScreenRepeat to true, in order to let the user keep on adding new records.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsOnOrder from products"
   objVbsDb( "GlobalStartScreen" ) = "search"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalFieldHeaders 
Renames field names in all table headers.
Syntax
objVBSdb("GlobalFieldHeaders") = "fieldName|headerValue; repeat..."
Examples:
objVBSdb("GlobalFieldHeaders") = "ProductId|Product Id;Product Name|Model"
objVBSdb("GlobalFieldHeaders") = "ci_name|City Name;ci_zip|ZIP"
Description
Use this property if you want the user to see more readable field headers. It can be useful, for example, to add blanks in field Headers. If a field name contains spaces, write it without brackets. If you want an Header to be completely blank, use a single blank space as the header value.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName from products"
   objVbsDb( "GlobalFieldHeaders" ) = "ProductId|Product Id;ProductName|Product"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalTableBGColor 
Defines the table background color for all the tables.
Syntax
objVBSdb("GlobalTableBGColor") = "a valid color identifier"
Examples:
objVBSdb("GlobalTableBGColor") = "#cccccc"
objVBSdb("GlobalTableBGColor") = "blue"
Description
Use this property to change the layout of every table: it defines the table background color.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsInStock,UnitsOnOrder from products"
   objVbsDb( "GlobalTableBGColor" ) = "yellow"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalTableFGColor 
Defines the table foreground color for all the tables.
Syntax
objVBSdb("GlobalTableFGColor") = "a valid color identifier"
Examples:
objVBSdb("GlobalTableFGColor") = "#000000"
objVBSdb("GlobalTableFGColor") = "black"
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsInStock,UnitsOnOrder from products"
   objVbsDb( "GlobalTableFGColor" ) = "green"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalHeaderBGColor 
Defines the header background color for all the tables.
Syntax
objVBSdb("GlobalHeaderBGColor") = "a valid color identifier"
Examples:
objVBSdb("GlobalHeaderBGColor") = "#ffb6c1"
objVBSdb("GlobalHeaderBGColor") = "red"
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsInStock,UnitsOnOrder from products"
   objVbsDb( "GlobalHeaderBGColor" ) = "#ffb6c1"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalHeaderFGColor 
Defines the header foreground color for all the tables.
Syntax
objVBSdb("GlobalHeaderFGColor") = "a valid color identifier"
Examples:
objVBSdb("GlobalHeaderFGColor") = "#adff2f"
objVBSdb("GlobalHeaderFGColor") = "red"
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsInStock,UnitsOnOrder from products"
   objVbsDb( "GlobalHeaderFGColor" ) = "#adff2f"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalImageDir 
Path to the folder containing VBSdb related images (buttons and others).
Syntax
objVBSdb("GlobalImageDir") = "virtual path to the image folder"
Examples:
objVBSdb("GlobalImageDir") = "../images/"
objVBSdb("GlobalImageDir") = "/inc/VBSdb/images/"
Description
This property allows the developer to customize various VBSdb images. In the VBSdb distribution, the folder VBSdb/images/ contains default images, you can freely use on your sites.
If you want to change VBSdb layout for your needs, build a new folder, where you change images, while keeping image names. You have to assign the virtual path, from the asp page where you are using VBSdb, to the folder where images are contained. Both absolute and relative path can be used.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsOnOrder from products"
   objVbsDb( "GlobalImageDir" ) = "VBSdb/images"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalLanguage 
Identifies the language for current VBSdb object.
Syntax
objVBSdb("GlobalLanguage") = string. Accepted values are "English" (default), "French" , "Italian" , "Portuguese", "Spanish", "German" and "Dutch" (case insensitive)
Examples:
objVBSdb("GlobalLanguage") = "English"
objVBSdb("GlobalLanguage") = session( "chosenLanguage" )
Description
This property is used implement internationalization. It allows to set the standard language 'spoken' by the current VBSdb object. Then, each standard text string can be further customized by means of the GlobalCustomText property. Note that, thanks of VBSdb object orientness, two or more objects can be displayed on the same page, each with its own language.
Up to date, the supported languages are English, French, German, Italian, Portuguese and Spanish. Adding a new language is trivial: take a look at the VBSdb/languages/ subfolder. We are committed to add many more languages in the next future.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
   objVbsDb( "GlobalLanguage" ) = "Italian"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalCustomText 
Customizes text messages.
Syntax
objVBSdb("GlobalCustomText") = "textItemName|textItemValue; repeat..."
Examples:
objVBSdb("GlobalCustomText") = "searchScreenTitle|Search for products;searchScreenTitle|Add a new Product"
objVBSdb("GlobalCustomText") = "updateFormRightHeader|Current Employee"
Description
Use this property if you want to customize the standard text VBSdb displays to the user. The default text is determined by the GlobalLanguage property (English is the default language).
For example, assume you want to show english messages and you want to customize the Delete Screen title to "Delete current Product" (default title would be a more general "Delete current record"). Take a look at VBSdb/languages/ subfolder: the file inc_english.asp is present. Open inc_english.asp and search for "Delete current record". You can see that the corresponding dictionary item name is english_deleteScreenTitle. Well, deleteScreenTitle is the text item name and it is invariant in all languages. The english_ prefix determines the language for which the text is specified. So, what you have to do is simply to instruct VBSdb that you want to change the text value for deleteScreenTitle and you can do it by including the definition "deleteScreenTitle|Delete current Product" in the GlobalCustomText assignment.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "GlobalId" ) = "Orders"
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Emplyees"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   objVbsDb( "GlobalCustomText" ) = "addScreenTitle|This is a custom Add Screen title;addCancelContent|Back"
   VbsDb objVbsDb
   VbsDbClose objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalReset 
Resets the VBSdb behavior.
Syntax
objVBSdb("GlobalReset") = boolean
Examples:
objVBSdb("GlobalReset") = true
objVBSdb("GlobalReset") = ( request( "reset" ) = "yes" )
Description
When GlobalReset is set to true (false is the default), VBSdb behaves as if the site visitor has just arrived to the current page from an external page. Thus, the VBSdb session variables are reset. Please, note that VBSdb uses just three light session variables, to remember the following pieces of information:
  • the absolute position of the displayed Form, with respect to the Grid
  • the order by clause (if) set by the site visitor by clicking on a Grid column header
  • the filter where clause, if a filtering condition is set
The GlobalReset property is useful when the developer wants to force VBSdb to be reset, even if the containing page calls itself (in this case, by default, VBSdb would assume it has to keep its state unchanged).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from Products"
   if Request.QueryString( "search" ) = "yes" then
       objVbsDb( "GlobalReset" ) = true
       objVbsDb( "GlobalStartScreen" ) = "search"
   end if
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalCSS 
Path to the style sheet .css file.
Syntax
objVBSdb("GlobalCSS") = "virtual path to the .css file" (default is the empty string)
Examples:
objVBSdb("GlobalCSS") = "myCss.css"
objVBSdb("GlobalCSS") = "/inc/VBSdb/VbsDb.css"
Description
This property allows the developer to customize the VBSdb object layouts. By default, GlobalCSS is the empty string. In this case:
  • a STYLE element is output within the generated html code
  • some standard style features can be overridden by setting color properties like, for example, the GlobalTableBGColor property
On the contrary, if the GlobalCSS property is set to a CSS style sheet file, then
  • no STYLE element is output within the generated html code
  • a link element to the external CSS file is output within the generated html code
  • color properties like, for example, the GlobalTableBGColor property, have no effect on the VBSdb layout. Customize the CSS file to change VBSdb object layouts
VBSdb is distributed along with the standard style sheet file VbsDb.css (you can find it in the VBSdb folder). The best way to build a custom layout is to make a personal copy of the VbsDb.css file and to change some property assignments. Comments are provided within the VbsDb.css file, in order to suggest the developer how to achieve a particular result.
For the sake of simplicity, the style sheet elements (classes and unique IDs) have been clearly divided into four sections:
  • Grid related attributes
  • Form related attributes
  • Other View screen related attributes
  • Input screen related attributes
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GlobalCSS" ) = "GlobalCSSExample.css"
   objVbsDb( "GridFields" ) = "LastName;FirstName"
   objVbsDb( "GridPageSize" ) = 6
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalSeparators 
Sets non default separators.
Syntax
objVBSdb("GlobalSeparators") = "propertyName1 primarySeparator1 secondarySeparator1 propertyName2 primarySeparator2 secondarySeparator2 ... repeat ..." (a blank separated list)
Examples:
objVBSdb("GlobalSeparators") = "ViewFieldFormats # | GlobalFieldHeaders $ {"
objVBSdb("GlobalSeparators") = "ViewFieldFormats & #"
Description
Default separators for properties are the semicolon ';' and the pipe '|'. Sometimes, such separators limit the developer: for instance if you want to insert some javascript within your ViewFieldFormats cell formatting, you have to use semicolons within the ViewFieldFormats values. If you had to use the default separators, VBSdb would not be able to understand which semicolons are to be considered a separator and which ones are to be considered javascript semicolons. Using the GlobalSeparators property you will instruct VBSdb that, for the ViewFieldFormats property, a new character has to be considered a separator, instead of the semicolon. This way, you will be able to get semicolons in the resulting formatted cell.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GlobalSeparators" ) = "ViewFieldFormats # |"
   objVbsDb( "ViewFieldFormats" ) = "ProductName|<font color=green>{{ProductName}}</font>#" & _
                                                      "QuantityPerUnit|{{QuantityPerUnit}}<font color=red>;</font>"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalQuerystringPreserve 
Preserves the QueryString value.
Syntax
objVBSdb("GlobalQuerystringPreserve") = boolean (default is false)
Examples:
objVBSdb("GlobalQuerystringPreserve") = true
objVBSdb("GlobalQuerystringPreserve") = ( request( "preserveParameters" ) = "yes" )
Description
When GlobalQuerystringPreserve is set to true (false is the default), VBSdb keeps the starting queryString value for all subsequent screens.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Suppliers inner join Products on Suppliers.SupplierID = Products.SupplierID"
   objVbsDb( "GlobalQuerystringPreserve" ) = true
   objVbsDb( "GridFields" ) = "ProductName;CompanyName"
   objVbsDb( "FormFields" ) = "CompanyName;ProductName;UnitPrice"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;search;add;update;delete"
%>
On Line Example
A live example of this property can be found here.
 GlobalOleDbProvider 
Identifies the kind of OLE DB provider.
Syntax
objVBSdb("GlobalOleDbProvider") = string (case insensitive). Accepted values are "JET.4.0" (default), "JET.3.51", "ODBC"", "Automatic"
Examples:
objVBSdb("GlobalOleDbProvider") = "JET.3.51"
objVBSdb("GlobalOleDbProvider") = "ODBC"
Description
This property is used to build the DSN-Less connection to the Microsoft Access databases.
JET.4.0 is the best choice for Microsoft Access 2000, while JET.3.51 is the best choice for Microsoft Access 97. You can also decide to use an Ole Db over ODBC provider.
If you assign the "Automatic" value, VBSdb automatically tries to find the best Ole Db provider available on the system.
Attention: using the Jet provider you can (and have to) disambiguate field names using the "tableName.fieldName" notation. Of course, you have to do it only when an ambiguity arises (that is, when a join involves different tables containing fields with the same name) and you have to do it only for those properties that refer to the Sql fields, not for those properties that refer to the edit table (that are those properties whose name begins with Edit).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "GlobalOleDbProvider" ) = "ODBC"
   objVbsDb( "Sql" ) = objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from Products"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GlobalPagePositioning 
Positions the browser position when returning back.
Syntax
objVBSdb("GlobalPagePositioning") = string (case insensitive). Accepted values are "Top" (default), "VBSdb"
Examples:
objVBSdb("GlobalPagePositioning") = "VBSdb"
objVBSdb("GlobalPagePositioning") = "Top"
Description
This property is used to instruct the Browser where to point when the site visitor clicks on a VBSdb button or link and the page is reloaded.
By default, the browser will point to the top of the next reloaded page. If you assign "VBSdb" to the GlobalPagePositioning porperty, then the browser will point to the html zone created by VBSdb.
You may wish to set this property value when you have a VBSdb object that displays beyond the bottom of your page (it often happens for subtable's VBSdb objects). In such a case, having the browser to point back to the VBSdb object itself, will probably offer a better experience to the site visitor.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "GlobalPagePositioning" ) = "VBSdb"
   objVbsDb( "Sql" ) = objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from Products"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewMode 
Set which combination of grid and form is to be shown in view mode.
Syntax
objVBSdb("ViewMode") = string. Accepted values are "grid", "form", "grid-form", "grid|form" (case insensitive). Default is "grid-form".
Examples:
objVBSdb("ViewMode") = "grid"
objVBSdb("ViewMode") = "grid|form"
Description
Use this property to decide what to display and how to display it, in view screen mode. If you set this property to "grid", then only the grid is shown. "form" displays only the form. "grid-form" (the default) displays the grid on the left and the current record form on the left. Finally, "grid|form" displays the grid at the top and the detailed form at the bottom.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsOnOrder from products"
   objVbsDb( "ViewMode" ) = "grid|form"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewNavigationButtons 
Set which buttons to show in the navigation bar(s).
Syntax
objVBSdb("ViewNavigationButtons") = string (a semicolon separated sequence of button names).
Default is "first;next;prev;last;removeFilter;search".
Accepted button names are "first", "next", "prev", "last", "removeFilter", "search", "add", "update" and "delete" (case insensitive).
Examples:
objVBSdb("ViewNavigationButtons") = "first;prev;next;last;removeFilter;search;add"
objVBSdb("ViewNavigationButtons") = "first;prev;next;last;removeFilter;search;add;update;delete"
Description
This property determines which navigation buttons are to be displayed. Use semicolon as separator (this is the standard syntax, but you can use also colons and pipes: VBSdb will translate them into semicolons).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsOnOrder from products"
   objVbsDb( "ViewNavigationButtons" ) = "next;prev"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewNavigationPosition 
Set where navigation bar(s) will be diplayed.
Syntax
objVBSdb("ViewNavigationPosition") = string. Accepted values are "top", "bottom", "both" and "none" (case insensitive).
Examples:
objVBSdb("ViewNavigationPosition") = "top"
objVBSdb("ViewNavigationPosition") = "both"
Description
This property determines where the navigation bar(s) will be displayed. If "top" is assigned, then the bar will be centered over the grid and the form. If "bottom" is assigned, then the bar will be under such two objects.
If "both" is the property value, then two identical navigation bar will be displayed: one at the top and one at the bottom. This is particularly useful when GridPageSize is set to an high value, such that the browser have to be heavely scrolled to get to the bottom of the Grid.
Finally, "none" means that no navigation bar has to be shown. This option can be used, coupled with ViewFieldFormats, to easily build an update grid, allowing the site user to change many recordset rows in a single screen.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsOnOrder from products"
   objVbsDb( "ViewNavigationPosition" ) = "both"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewNavigationBGColor 
Defines the background color for navigation buttons.
Syntax
objVBSdb("ViewNavigationBGColor") = "a valid color identifier"
Examples:
objVBSdb("ViewNavigationBGColor") = "#cccccc"
objVBSdb("ViewNavigationBGColor") = "blue"
Description
Use this property to change navigation buttons background, when GlobalImageDir is not set and buttons are displayed as simple text. Default is #d3d3d3.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "ViewNavigationBGColor" ) = "yellow"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewNavigationFGColor 
Defines the foreground color for enabled navigation buttons.
Syntax
objVBSdb("ViewNavigationFGColor") = "a valid color identifier"
Examples:
objVBSdb("ViewNavigationFGColor") = "#cccccc"
objVBSdb("ViewNavigationFGColor") = "blue"
Description
Use this property to change navigation buttons foreground, when GlobalImageDir is not set and buttons are displayed as text links. Default is #000000.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "ViewNavigationFGColor" ) = "blue"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewNavigationDisabledFGColor 
Defines the foreground color for disabled navigation buttons.
Syntax
objVBSdb("ViewNavigationDisabledFGColor") = "a valid color identifier"
Examples:
objVBSdb("ViewNavigationDisabledFGColor") = "#cccccc"
objVBSdb("ViewNavigationDisabledFGColor") = "blue"
Description
Use this property to change disabled navigation buttons foreground, when GlobalImageDir is not set and buttons are displayed as simple text (disabled link). Default is #9C9A9C.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "ViewNavigationDisabledFGColor" ) = "blue"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewPosition 
Set if paging informations are to be displayed.
Syntax
objVBSdb("ViewPosition") = boolean (default is false)
Examples:
objVBSdb("ViewPosition") = true
objVBSdb("ViewPosition") = ( session( "userName" ) = "admin" )
Description
This property determines if paging informations will be displayed. If set, the site visitor will be provided with the following (customizable) pieces of information:
  1. Records displayed in the current page with respect to the total number of records in the grid.
  2. Current page with respect to the total number of pages in the grid.
To customize the nature of the informations displayed (and the layout), simply use the GlobalCustomText property and modify the viewPosition text item.
Within this text item name, the following VBSdb tags are recognized:
  • <FirstRecordInThePage>: represents the first record number in the current page
  • <LastRecordInThePage>: represents the last record number in the current page
  • <TotalRecords>: represents the total number of records in the Grid
  • <CurrentPage>: represents the current page number in the Grid
  • <TotalPages>: represents the total number of pages in the Grid
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice,UnitsOnOrder from products"
   objVbsDb( "ViewPosition" ) = true
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 ViewFieldFormats 
Fully customizes the field cell content.
Syntax
objVBSdb("ViewFieldFormats") = "fieldName|HtmlFormatFunction; repeat..."
Examples:
objVBSdb("ViewFieldFormats") = "Last Name|<font color='green'>{{First Name}} {{Last Name}}</font>"
objVBSdb("ViewFieldFormats") = "City|<a href='cities.asp?city={{CityID}}'>{{City}}</a>"
Description
This property determines the real content of the cell. HtmlFormatFunction is an html string where variables and functions can be used.

A variable is a Sql field name, enclosed in double brackets ("{{","}}"). In each grid row (and in the form), the single variable name is substituted by the corresponding Sql field value. If a field name contains spaces, write it without brackets.

A function is a string built with reserved tags, to represent a VBScript function to be invoked to fully format each record field value. The supported tags are:
<VbsDbExecute>, </VbsDbExecute>, <VbsDbFieldParameter>, </VbsDbFieldParameter>
Please, check the GridTemplate documentation to see how you can use these four tags (they have the same syntax and semantics for the ViewFieldFormats property).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = constMdbPathForExamples
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "ViewFieldFormats" ) = "UnitPrice|<font color=" & _
      "<VbsDbExecute>PriceColor(<VbsDbFieldParameter>UnitPrice<VbsDbFieldParameter>)</VbsDbExecute>" & _
      ">{{UnitPrice}}</font>"

   VbsDb objVbsDb
%>
On Line Examples
A simple live example of this property can be found here. A more sophisticated example, using <VbsDbExecute> and <VbsDbFieldParameter> elements can be found here.
 GridFields 
Set the list of the fields to be diplayed in the grid.
Syntax
objVBSdb("GridFields") = "field1;field2;... repeat"
Examples:
objVBSdb("GridFields") = "Product Name;UnitPrice"
objVBSdb("GridFields") = "LastName;FirstName"
Description
Use GridFields to set which Sql fields are to be shown in the Grid. GridFields defaults to the empty string. Il GridFields is empty, then all fields in the Sql recordset are displayed. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridFields" ) = "ProductName;UnitPrice"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridHideFields 
Set the list of the Sql fields that must not display in the Grid.
Syntax
objVBSdb("GridHideFields") = "field1;field2;... repeat"
Examples:
objVBSdb("GridHideFields") = "ProductId;SupplierId;Product Name"
objVBSdb("GridHideFields") = "EmployeeId;Title"
Description
Use GridHideFields to set which Sql fields are not to be displayed in the Grid. It is particularly useful when most of the Sql recordset fields are to be shown. In such a case, it would be slower to list them in the GridFields property: use GridHideFields instead. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Categories"
   objVbsDb( "GridHideFields" ) = "CategoryId;Picture"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridShowIndex 
Set the list of the Sql fields that must not display in the Grid.
Syntax
objVBSdb("GridShowIndex") = boolean (default is true)
Examples:
objVBSdb("GridShowIndex") = True
objVBSdb("GridShowIndex") = ( session( "user" ) = "administrator" )
Description
Use GridShowIndex to hide the grid index column.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "ViewMode" ) = "grid"
   objVbsDb( "GridShowIndex" ) = false
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridTableTag 
Set the Grid table layout.
Syntax
objVBSdb("GridTableTag") = string
Examples:
objVBSdb("GridTableTag") = "bgcolor=green border=1"
objVBSdb("GridTableTag") = "class=productForm"
Description
Use GridTableTag to customize the grid table layout. A class attribute can be used, to be referred to by a style sheet file (like css).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridTableTag" ) = "border=1 cellpadding=2"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridPageSize 
Set the number of record to be shown in each page size.
Syntax
objVBSdb("GridPageSize") = long
Examples:
objVBSdb("GridPageSize") = 1
objVBSdb("GridPageSize") = constPageSize
Description
Use GridPageSize to customize the grid table layout. A class attribute can be used, to be referred to by a style sheet file (like css).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridPageSize" ) = 8
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridHorizontalStripeBGColor 
Defines the horizontal stripe color for the Grid.
Syntax
objVBSdb("GridHorizontalStripeBGColor") = "a valid color identifier"
Examples:
objVBSdb("GridHorizontalStripeBGColor") = "#cccccc"
objVBSdb("GridHorizontalStripeBGColor") = "blue"
Description
This property defines the alternating background color for rows in the grid.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridHorizontalStripeBGColor" ) = "#99ccff"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridSelectedIndexBGColor 
Defines the background color for the selected index cell.
Syntax
objVBSdb("GridSelectedIndexBGColor") = "a valid color identifier"
Examples:
objVBSdb("GridSelectedIndexBGColor") = "#cccccc"
objVBSdb("GridSelectedIndexBGColor") = "blue"
Description
When GridShowIndex is set to true (the default), a column is added to the grid, showing a record number. If the site user clicks the number, a detailed view of the selected record is shown in the view screen form. GridSelectedIndexBGColor defines the background color for the cell where the index link was clicked (thus emphasizing the grid position of the form record).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridSelectedIndexBGColor" ) = "#339966"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridSelectedIndexFGColor 
Defines the foreground color for the selected index cell.
Syntax
objVBSdb("GridSelectedIndexFGColor") = "a valid color identifier"
Examples:
objVBSdb("GridSelectedIndexFGColor") = "#cccccc"
objVBSdb("GridSelectedIndexFGColor") = "blue"
Description
When GridShowIndex is set to true (the default), a column is added to the grid, showing a record number. If the site user clicks the number, a detailed view of the selected record is shown in the view screen form. GridSelectedIndexFGColor defines the foreground color for the cell where the index link was clicked (thus emphasizing the grid position of the form record).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridSelectedIndexFGColor" ) = "yellow"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridUnselectedIndexFGColor 
Defines the foreground color for unselected index cells.
Syntax
objVBSdb("GridUnselectedIndexFGColor") = "a valid color identifier"
Examples:
objVBSdb("GridUnselectedIndexFGColor") = "#cccccc"
objVBSdb("GridUnselectedIndexFGColor") = "blue"
Description
When GridShowIndex is set to true (the default), a column is added to the grid, showing a record number. If the site user clicks the number, a detailed view of the selected record is shown in the view screen form. GridUnselectedIndexFGColor defines the foreground color for the cells where the index link was not clicked: by contrast, the grid position of the form record is emphasized.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "GridUnSelectedIndexFGColor" ) = "blue"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridDeleteButtons 
Add to the grid a column of delete icons.
Syntax
objVBSdb("GridDeleteButtons") = boolean
Examples:
objVBSdb("GridDeleteButtons") = false
objVBSdb("GridDeleteButtons") = ( session( "userName" ) = "Admin" )
Description
When GridDeleteButtons is set to true (false is the default), a column is added to the grid, showing delete icons (that can be easily customized). If the site user clicks one of these icons, the correspondent record is displayed in a delete screen, where deletion can be confirmed.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridHideFields" ) = "Title"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "GlobalImageDir" ) = "VBSdb/images"
   objVbsDb( "GridUpdateButtons" ) = true
   objVbsDb( "GridDeleteButtons" ) = true
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridUpdateButtons 
Add to the grid a column of update icons.
Syntax
objVBSdb("GridUpdateButtons") = boolean
Examples:
objVBSdb("GridUpdateButtons") = true
objVBSdb("GridUpdateButtons") = ( session( "userName" ) = "Admin" )
Description
When GridDeletButtons is set to true (false is the default), a column is added to the grid, showing delete icons (that can be easily customized). If the site user clicks one of these icons, the correspondent record is displayed in a delete screen, where deletion can be confirmed.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridHideFields" ) = "Title"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "GlobalImageDir" ) = "VBSdb/images"
   objVbsDb( "GridUpdateButtons" ) = true
   objVbsDb( "GridDeleteButtons" ) = true
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 GridTemplate 
Set an HTML template file for the Grid.
Syntax
objVBSdb("GridTemplate") = virtual path to the template file
Examples:
objVBSdb("GridTemplate") = "myTemplate.htm"
objVBSdb("GridTemplate") = "../templates/products.htm"
Description
Use GridTemplate to fully customize the grid table layout. The following VBSdb tags are recognized:
  • <VbsDbGridRow>: begins the grid row template. Each grid row is created using the html code contained between <VbsDbGridRow> and </VbsDbGridRow>
  • </VbsDbGridRow>: ends the grid row template. Each grid row is created using the html code contained between <VbsDbGridRow> and </VbsDbGridRow>
  • <VbsDbFieldValue>: begins a field name. The field name must be ended by the </VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template grid row, it is substituted with the corresponding field value formatted for view screens. Spaces between the field name and the tags are discarded.
  • </VbsDbFieldValue>: ends a field name. The field name must be preceded by the <VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template grid row, it is substituted with the corresponding field value formatted for view screens. Spaces between the field name and the tags are discarded.
  • <VbsDbExecute>: begins a server side formatting function. See the example below for further details. This feature is supported only by the VBScript Engine 5.0 or higher.
  • </VbsDbExecute>: ends a server side formatting function. See the example below for further details.
  • <VbsDbFieldParameter>: begins a field name. It can be used within a <VbsDbExecute> element, to pass a field value as a parameter to the server side formatting function. The field name must be ended by the </VbsDbFieldParameter> tag. See the example below for further details.
  • </VbsDbFieldParameter>: ends a field name. It can be used within a <VbsDbExecute> element, to pass a field value as a parameter to the server side formatting function. The field name must be preceded by the <VbsDbFieldParameter> tag. See the example below for further details.
For better understanding the template syntax and semantics, please have a look at the following template example.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   objVbsDb( "ViewMode" ) = "Grid"
   objVbsDb( "GridTemplate" ) = "GridTemplateExample.htm"
   VbsDb objVbsDb
%>
Template file example
<VbsDbGridRow>
   <TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
      <TR>
        <TD align=right>Product Name:</TD>
        <TD colSpan=5 align=left><VbsDbFieldValue>ProductName</VbsDbFieldValue></TD>
      </TR>
      <TR>
        <TD width=130 align=right>Quantity per Unit:</TD>
        <TD width=150><VbsDbFieldValue>QuantityPerUnit</VbsDbFieldValue></TD>
        <TD width=110 align=right>Units in Stock:</TD>
        <TD width=30 align=center>
           <VbsDbExecute>FormattedUnits(<VbsDbFieldParameter>UnitsInStock</VbsDbFieldParameter>)</VbsDbExecute>
        </TD>
        <TD width=100 align=right>Units on Order:</TD>
        <TD width=40 align=right><VbsDbFieldValue>UnitsOnOrder</VbsDbFieldValue></TD>
      </TR>
      <TR>
        <TD align=right>Reorder Level:</TD>
        <TD><VbsDbFieldValue>ReorderLevel</VbsDbFieldValue></TD>
        <TD align=right>Discontinued:</TD>
        <TD align=center><VbsDbFieldValue>Discontinued</VbsDbFieldValue></TD>
        <TD align=right>Unit Price:</TD>
        <TD align=right><VbsDbFieldValue>UnitPrice</VbsDbFieldValue></TD>
      </TR>
   </TABLE>
</VbsDbGridRow>
Template example explanation
Let's analize the above Template example.
In each row, VBSdb will replace the <VbsDbFieldValue>ProductName</VbsDbFieldValue> code with the ProductName value for the corresponding record. So you can use the <VbsDbFieldValue> element wherever you want to place your field values in a certain position of your Grid row template.

Now, please, focus on the
<VbsDbExecute>FormattedUnits(<VbsDbFieldParameter>UnitsInStock</VbsDbFieldParameter>)</VbsDbExecute> template statement.
It states that VBSdb will replace such code with the string returned by the FormattedUnits function. Such function must be defined in the ASP page calling VBSdb (it could also be any standard VBScript function).

This is the code implementing our FormattedUnits function, for the above example:
   '***********************************************
   function FormattedUnits( strUnitsInStock )
   '***********************************************
      if strUnitsInStock < 20 then
         FormattedUnits = "<font color=red>" & strUnitsInStock & "</font>"
      else
         FormattedUnits = "<font color=green>" & strUnitsInStock & "</font>"
      end if
   end function

As you can see, FormattedUnits is a function with a single parameter (the UnitsInStock field value) and it returns some html code (to display the UnitsInStock field value in red if the number of units in stock are less than 20).
In the template, we use <VbsDbFieldParameter>UnitsInStock</VbsDbFieldParameter> to actually pass the UnitsInStock value as a parameter for the FormattedUnits function.

Now, let's focus on the difference between <VbsDbFieldValue> and <VbsDbFieldParameter>.
<VbsDbFieldValue> instructs VBSdb to output the field value as it would have been displayed in a standard grid (so the value is html encoded, unless it is a ViewFieldFormats field).
<VbsDbFieldParameter> is instead used to build a string constant parameter to be passed to the formatting function to be executed server side. So VBSdb performs two steps:
1) all <VbsDbFieldParameter> elements are replaced with a string constant representing the corresponding field value
2) the resulting VBScript function call is performed and the returned value replaces the full <VbsDbExecute> element

To better understand the described process, let's get back to our example. Assume 30 is the UnitsInStock field value for the current Grid record. VBSdb finds the
<VbsDbExecute>FormattedUnits(<VbsDbFieldParameter>UnitsInStock</VbsDbFieldParameter>)</VbsDbExecute> instruction. The first step transforms the
<VbsDbFieldParameter>UnitsInStock</VbsDbFieldParameter>
element to the "30" constant. So, the <VbsDbExecute> element becomes
<VbsDbExecute>FormattedUnits("30")</VbsDbExecute>.
The second step executes the FormattedUnits("30") function call. The function returns the string "<font color=green>30</font>" and this string is the final result of the complete <VbsDbExecute> element transformation.

Please note that the <VbsDbFieldParameter> is always transformed to a VBScript string constant. Thus the field value is enclosed in double quotes. Furthermore, any contained double quote is doubled (according to the VBScript standard method to represent quotes into string constants). Finally, any carriage return is replaced by a "<br>" token (to keep the <VbsDbExecute> elemento on a single line).
On Line Examples
A simple live example of this property can be found here. A more sophisticated example, using <VbsDbExecute> and <VbsDbFieldParameter> elements can be found here.
 FormFields 
Set the list of the fields to be diplayed in the form.
Syntax
objVBSdb("FormFields") = "field1;field2;... repeat"
Examples:
objVBSdb("FormFields") = "ProductName;UnitPrice"
objVBSdb("FormFields") = "LastName;FirstName"
Description
Use FormFields to set which Sql fields are to be shown in the Form. FormFields defaults to the empty string. Il FormFields is empty, then all fields in the Sql recordset are displayed. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "FormFields" ) = "ProductName;UnitPrice"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 FormHideFields 
Set the list of the Sql fields that must not be displayed in the Form.
Syntax
objVBSdb("FormHideFields") = "field1;field2;... repeat"
Examples:
objVBSdb("FormHideFields") = "ProductId;SupplierId"
objVBSdb("FormHideFields") = "EmployeeId;Title"
Description
Use FormHideFields to set which Sql fields are not to be displayed in the Form. It is particularly useful when most of the Sql recordset fields are to be shown. In such a case, it would be slower to list them in the FormFields property: use FormHideFields instead. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Categories"
   objVbsDb( "GridHideFields" ) = "CategoryId;Description;Picture"
   objVbsDb( "FormHideFields" ) = "CategoryId;Picture"
   VbsDb objVbsDb    VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 FormTableTag 
Set the Form table layout.
Syntax
objVBSdb("FormTableTag") = string
Examples:
objVBSdb("FormTableTag") = "bgcolor=green border=1"
objVBSdb("FormTableTag") = "class=productGrid"
Description
Use FormTableTag to customize the form table layout. A class attribute can be used, to be referred to by a style sheet file (like css).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,QuantityPerUnit,UnitPrice from products"
   objVbsDb( "FormTableTag" ) = "border=1 cellpadding=2"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 FormTemplate 
Set an HTML template file for the Form.
Syntax
objVBSdb("FormTemplate") = virtual path to the template file
Examples:
objVBSdb("FormTemplate") = "myTemplate.htm"
objVBSdb("FormTemplate") = "../templates/products.htm"
Description
Use FormTemplate to fully customize the Form layout in View screens. The following VBSdb tags are recognized:
  • <VbsDbFieldValue>: begins a field name. The field name must be ended by the </VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template form, it is substituted with the corresponding field value formatted for view screens. Spaces between the field name and the tags are discarded.
  • </VbsDbFieldValue>: ends a field name. The field name must be preceded by the <VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template form, it is substituted with the corresponding field value formatted for view screens. Spaces between the field name and the tags are discarded.
  • <VbsDbExecute>, </VbsDbExecute>, <VbsDbFieldParameter> and </VbsDbFieldParameter>. These four tags are used for more sophisticated field value's formatting. They allow you to apply VBScript server side functions to the form field values (for instance, they allow you to set up conditional formatting functions).
    To see the full documentation for these four tags, you are invited to check the GridTemplate documentation.
For better understanding the template syntax and semantics, please have a look at the following template example.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "FormTemplate" ) = "FormTemplateExample.htm"
   objVbsDb( "ViewFieldFormats" ) = "UnitPrice|<font color=red>{{UnitPrice}}</font>"
   VbsDb objVbsDb
%>
Template file example
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
    <TR>
       <TD align=right>Product Name:</TD>
       <TD colSpan=3 align=left><VbsDbFieldValue>ProductName</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Quantity per Unit:</TD>
       <TD><VbsDbFieldValue>QuantityPerUnit</VbsDbFieldValue></TD>
       <TD align=right>Units in Stock:</TD>
       <TD><VbsDbFieldValue>UnitsInStock</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Units on Order:</TD>
       <TD><VbsDbFieldValue>UnitsOnOrder</VbsDbFieldValue></TD>
       <TD align=right>Reorder Level:</TD>
       <TD><VbsDbFieldValue>ReorderLevel</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right> Discontinued:</TD>
       <TD><VbsDbFieldValue>Discontinued</VbsDbFieldValue></TD>
       <TD align=right>Unit Price:</TD>
       <TD><VbsDbFieldValue>UnitPrice</VbsDbFieldValue></TD>
    </TR>
</TABLE>
On Line Example
A live example of this property can be found here.
 FormExactAfterEdit 
Allows for research of the just edited record.
Syntax
objVBSdb("FormExactAfterEdit") = boolean (default is true)
Examples:
objVBSdb("FormExactAfterEdit") = true
objVBSdb("FormExactAfterEdit") = ( session( "fast" ) = false )
Description
This property determines if, when returning in View mode, VBSdb will search for the just edited record (was it a new added record or an updated one).
By default VBSdb does search for the last edited record. But this operation is time consuming (even if it is absolutely imperceptible unless your recordset contains thousands of records). Thus, in some scenarios, it would be preferrable to instruct VBSdb to behave faster (when it doesn't matter much to exactly return to the last edited record, once in View mode). In such cases, simply set the FormExactAfterEdit property to false.
Doing so VBSdb will try to guess the position of the last edited record: it will be faster, but it may fail its positioning in some cases (nevertheless, the database editing will always be correct).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridHideFields" ) = "Title"
   objVbsDb( "FormExactAfterEdit" ) = false
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;search;add"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "GlobalImageDir" ) = "VBSdb/images"
   objVbsDb( "GridUpdateButtons" ) = true
   objVbsDb( "GridDeleteButtons" ) = true
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 InputEnumeratedFields 
Set fields to be displayed as enumerated drop down controls .
Syntax
objVBSdb("InputEnumeratedFields") = "fieldA|value1|description1|value2|description2...;... repeat"
Examples:
objVBSdb("InputEnumeratedFields") = "CategoryId|4|Cheeses|6|Prepared meats"
objVBSdb("InputEnumeratedFields") = "Supplier Id|21|Lyngbysild|16|Bigfoot Breweries"
Description
Use InputEnumeratedFields to set those fields that are to be displayed in the Search, Add and Update screens, as html select elements. Such drop down controls will be pupulated by those values enumerated by the developer.
For instance, assume InputEnumeratedFields contains the following enumerated field definition: "FieldA|value1|description1|value2|description2": in input screens, FieldA will be represented by an html select element, containing two html options. The first html option content will be 'description1', while the first html option value will be 'value1'. Analogously, The second option content will be 'description2', and the second option value will be 'value2'. If, in the current screen, an input enumerated field is read only, then its corresponding lookup value is displayed.
If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "Sql" ) = "select * from Products inner join Suppliers on Products.SupplierID=Suppliers.SupplierID"
   objVbsDb( "GridFields" ) = "ProductName,CompanyName"
   objVbsDb( "ViewNavigationPosition" ) = "top"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;removeFilter;search;add;update"
   objVbsDb( "SearchFields" ) = "CategoryID;SupplierID"
   objVbsDb( "InputEnumeratedFields" ) = "CategoryId|4|Cheeses|6|Prepared meats;" & _
                                                                  "SupplierId|21|Lyngbysild|16|Bigfoot Breweries"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductID"
   objVbsDb( "GlobalFieldHeaders" ) = "CategoryID|Category;SupplierId|Supplier"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   VbsDb objVbsDb %>
On Line Example
A live example of this property can be found here.
 InputPasswordFields 
List of fields to be diplayed as password controls.
Syntax
objVBSdb("InputPasswordFields") = "field1;field2;... repeat"
Examples:
objVBSdb("InputPasswordFields") = "Password1;Password2"
objVBSdb("InputPasswordFields") = "LastName;FirstName"
Description
Use InputPasswordFields to set which Sql fields are to be shown as password controls in Input screens. InputPasswordFields defaults to the empty string. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName from Employees"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditFields" ) = "FirstName;LastName"
   objVbsDb( "InputPasswordFields" ) = "LastName"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 InputSelectFields 
Set fields to be displayed as sql select populated drop down controls .
Syntax
objVBSdb("InputSelectFields") = "field1|select statement;... repeat"
Examples:
objVBSdb("InputSelectFields") = "CategoryId|select CategoryId,CategoryName from suppliers"
objVBSdb("InputSelectFields") = "Supplier Id|select [Supplier Id],SupplierName from suppliers"
Description
Use InputSelectFields to set those fields that are to be displayed in the Search, Add and Edit screens, as html select element. Such drop down controls will be pupulated by fetching data using an sql statement. Each of these select statement, has to have two fields. Assume the statement is "select FieldA,FieldB from TableC": the returned recordset is used to populate the drop down input element. FieldA value is used as html option value, while FieldB value is used as html option content. If, in the current screen, an input select field is read only, then its corresponding lookup value is displayed.
If a field name contains spaces, write it without brackets (of course, in the select statement, such brackets must be added).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,SupplierId from products"
   objVbsDb( "InputSelectFields" ) = "SupplierId|select SupplierId,CompanyName from suppliers"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 InputValidateDateFields 
Set the list of the date type fields to be client side validated in input screens.
Syntax
objVBSdb("InputValidateDateFields") = "dateField1|alert message1;... repeat"
Examples:
objVBSdb("InputValidateDateFields") = "BirthDate|BirthDate is not a proper date"
objVBSdb("InputValidateDateFields") = "HireDate|HireDate error: date format is 'MM/DD/YYYY'
Description
Use InputValidateDateFields to set those fields that are to be inserted as date fields. A Javascript validation function will be invoked to check if those fields are of the proper date format. If not, an alert message will be displayed to the user.
The allowed date format is automatically determined by VBSdb. It depens upon the session.lcid value. So, the developer, can easily custom the proper date format, depending on the current user nationality (just set the corresponding session.lcid value, before invoking VbsDbNew).
This property can be effectively used, coupled with the VbsDbGetDateFormat method, to display the proper date format to the user (either in field header or in the alert message).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   session.lcid = 1033
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,BirthDate from Employees"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "EditAddFieldDefaults" ) = "LastName|MyLastName;FirstName|MyName;BirthDate|Not a date!"
   objVbsDb( "InputValidateDateFields" ) = "BirthDate|BirthDate is not a valid date" & _                                                                                    "(date format is 'MM/DD/YYYY hh:mm:ss')"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 SearchFields 
Set the list of the fields to be diplayed in the search screen.
Syntax
objVBSdb("SearchFields") = "field1;field2;... repeat"
Examples:
objVBSdb("SearchFields") = "ProductName;UnitPrice"
objVBSdb("SearchFields") = "LastName;FirstName"
Description
Use SearchFields to set which Sql fields are to be shown in the Search input screen. SearchFields defaults to the empty string. Il SearchFields is empty, then all fields in the Sql recordset are displayed. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,CategoryId,SupplierId from products"
   objVbsDb( "SearchFields" ) = "ProductName;CategoryId"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 SearchHideFields 
Set the list of the Sql fields that must not display in the Search screens.
Syntax
objVBSdb("SearchHideFields") = "field1;field2;... repeat"
Examples:
objVBSdb("SearchHideFields") = "ProductId;SupplierId;Product Name"
objVBSdb("SearchHideFields") = "EmployeeId;Title"
Description
Use SearchHideFields to set which Sql fields are not to be displayed in the Search screen. It is particularly useful when most of the Sql recordset fields are to be shown. In such a case, it would be slower to list them in the SearchFields property: use SearchHideFields instead. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Categories"
   objVbsDb( "SearchHideFields" ) = "CategoryId;Picture"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 SearchAliasFields 
Reverse map for field aliases.
Syntax
objVBSdb("SearchAliasFields") = "alias|fieldName; repeat..."
Examples:
objVBSdb("SearchAliasFields") = "ProductID|Products.ID"
objVBSdb("SearchAliasFields") = "SupplierID|Suppliers.SupplierID;CategoryID|Category.ID"
Description
Use this property if you used some aliases for fields in the Sql property and you want to use the VBSdb search screen. The SearchAliasFields property reverse maps field aliases, so that VBSdb can use the original field names to build the filter condition to be inserted into the Sql statement.
You also have to use SearchAliasFields to disambiguate field names if different tables are joined in your Sql query and a field name is common to more than one table (unless you use the Ole Db over Jet provider: in such a case, you will disambiguate the field name using the tableName.fieldName notation and you will not need the SearchAliasFields property).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Products inner join Suppliers on Products.SupplierID=Suppliers.SupplierID"
   objVbsDb( "GridFields" ) = "ProductName,CompanyName"
   objVbsDb( "ViewNavigationPosition" ) = "top"
   objVbsDb( "SearchFields" ) = "ProductName;SupplierID"
   objVbsDb( "SearchAliasFields" ) = "SupplierID|Suppliers.SupplierID"
   objVbsDb( "InputSelectFields" ) = "SupplierId|select SupplierId,CompanyName from Suppliers"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 SearchOperators 
Operators to be applied to searches.
Syntax
objVBSdb("SearchOperators") = "field1|operator1;field2|operator2;... repeat"
Accepted values for operators are < , <= , > , >=
Examples:
objVBSdb("SearchOperators") = "UnitPrice|<="
objVBSdb("SearchOperators") = "StartOrderDate|>=;MaxOrderTotal|<="
Description
Use SearchOperators to set which search fields are to be used with a comparison operator different from "=". The supported comparison operators are < , <= , > , >= .
You can use this property when you want to allow the site user to filter on min/max values.
It can be used with numeric and date fields.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductName,UnitPrice from products"
   objVbsDb( "ViewMode" ) = "Grid"
   objVbsDb( "GlobalStartScreen" ) = "Search"
   objVbsDb( "SearchOperators" ) = "UnitPrice|<="
   objVbsDb( "GlobalFieldHeaders" ) = "UnitPrice|Max Unit Price"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 SearchScreenRepeat 
Makes VBSdb start and keep in search mode.
Syntax
objVBSdb("SearchScreenRepeat") = boolean
Examples:
objVBSdb("SearchScreenRepeat") = true
objVBSdb("SearchScreenRepeat") = ( session( "userType" ) = "customer" )
Description
When SearchScreenRepeat is set to true (false is the default), VBSdb starts displaying the search screen, and when the search criteria are submitted, the subsequent screen is still of search type. It is usually used to keep on the same screen both a search form and the view grid (and the view form). To get this result, SearchScreenRepeat should be used coupled with the VbsDbGetOutputFieldValue method.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from employees"
   objVbsDb( "SearchScreenRepeat" ) = true
   objVbsDb( "SearchFields" ) = "EmployeeId"
   objVbsDb( "InputSelectFields" ) = "EmployeeId|select EmployeeId,LastName from Employees " & _                                                                    "order by LastName"
   VbsDb objVbsDb
   lngFirstName = VbsDbGetOutputFieldValue( "FirstName" , objVbsDb )
   VbsDbClose objVbsDb
   response.write "The last selected employee first name is " & lngFirstName
%>
On Line Example
A live example of this property can be found here.
 SearchTemplate 
Set an HTML template file for the Search screen.
Syntax
objVBSdb("SearchTemplate") = virtual path to the template file
Examples:
objVBSdb("SearchTemplate") = "myTemplate.htm"
objVBSdb("SearchTemplate") = "../templates/products.htm"
Description
Use SearchTemplate to fully customize the Search screen layout. The following VBSdb tags are recognized:
  • <VbsDbFieldValue>: begins a field name. The field name must be ended by the </VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the input control corresponding to the field. Spaces between the field name and the tags are discarded.
  • </VbsDbFieldValue>: ends a field name. The field name must be preceded by the <VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the input control corresponding to the field. Spaces between the field name and the tags are discarded.
  • <VbsDbInputSubmit>: represents the search screen Submit button. If <VbsDbInputSubmit> is found in the template file, it is substituted with the submit button for the search form.
  • <VbsDbInputReset>: represents the search screen Reset button. If <VbsDbInputReset> is found in the template file, it is substituted with the reset button for the search form.
  • <VbsDbInputCancel>: represents the search screen Cancel button. If <VbsDbInputCancel> is found in the template file, it is substituted with the cancel button for the search form.
For better understanding the template syntax and semantics, please have a look at the following template example.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "SearchTemplate" ) = "SearchTemplateExample.htm"
   objVbsDb( "GlobalStartScreen" ) = "Search"
   VbsDb objVbsDb
%>
Template file example
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
    <TR>
       <TD align=right>Product Name:</TD>
       <TD colSpan=3 align=left><VbsDbFieldValue>ProductName</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Quantity per Unit:</TD>
       <TD><VbsDbFieldValue>QuantityPerUnit</VbsDbFieldValue></TD>
       <TD align=right>Units in Stock:</TD>
       <TD><VbsDbFieldValue>UnitsInStock</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Units on Order:</TD>
       <TD><VbsDbFieldValue>UnitsOnOrder</VbsDbFieldValue></TD>
       <TD align=right>Reorder Level:</TD>
       <TD><VbsDbFieldValue>ReorderLevel</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right> Discontinued:</TD>
       <TD><VbsDbFieldValue>Discontinued</VbsDbFieldValue></TD>
       <TD align=right>Unit Price:</TD>
       <TD><VbsDbFieldValue>UnitPrice</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=center colspan=4><VbsDbInputSubmit> <VbsDbInputReset> <VbsDbInputCancel></TD>
    </TR>
</TABLE>
On Line Example
A live example of this property can be found here.
 EditTableName 
Set the edit table name.
Syntax
objVBSdb("EditTableName") = string
Examples:
objVBSdb("EditTableName") = "Products"
objVBSdb("EditTableName") = "Order Details"
Description
EditTableName identifies the table whose records will be edited (added, updated, deleted). If a edit table name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName,CategoryId,SupplierId from products"
   objVbsDb( "GridHideFields" ) = "ProductId;SupplierId"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
%>
On Line Example
A live example of this property can be found here.
 EditKeyFields 
Set the edit key fields.
Syntax
objVBSdb("EditKeyFields") = "field1;field2;... repeat"
Examples:
objVBSdb("EditKeyFields") = "Product Name"
objVBSdb("EditKeyFields") = "LastName;FirstName;BirthDate"
Description
EditKeyFields denotes a set of edit table key fields. Key field values must be unique for each record in the edit table, because the key field values are used to identify the record to be edited (updated or deleted). Since such fields cannot be updated, in update screens they are automatically set to read only. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName,CategoryId,SupplierId from products"
   objVbsDb( "GridHideFields" ) = "ProductId;SupplierId"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
%>
On Line Example
A live example of this property can be found here.
 EditFields 
Set the list of the fields to be editable in edit screens.
Syntax
objVBSdb("EditFields") = "field1;field2;... repeat"
Examples:
objVBSdb("EditFields") = "Product Name;UnitPrice"
objVBSdb("EditFields") = "LastName;FirstName"
Description
Use EditFields to set which edit table fields are to be shown in the add, edit and delete screens. If a field name contains spaces, write it without brackets. EditFields defaults to the empty string. Il EditFields is empty, then all fields in the edit table are displayed.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
%>
On Line Example
A live example of this property can be found here.
 EditHideFields 
Set the list of the edit table fields that must not display in Edit screens.
Syntax
objVBSdb("EditHideFields") = "field1;field2;... repeat"
Examples:
objVBSdb("EditHideFields") = "ProductId;Product Name;SupplierId"
objVBSdb("EditHideFields") = "EmployeeId;Title"
Description
Use EditHideFields to set which edit table fields are not to be displayed in add, update and delete screens. It is particularly useful when most of the edit table recordset fields are to be shown. In such a case, it would be slower to list them in the EditFields property: use EditHideFields instead. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Categories"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "GridHideFields" ) = "CategoryId;Picture"
   objVbsDb( "FormHideFields" ) = "Picture"
   objVbsDb( "EditTableName" ) = "Categories"
   objVbsDb( "EditKeyFields" ) = "CategoryId"
   objVbsDb( "EditHideFields" ) = "Picture"
%>
On Line Example
A live example of this property can be found here.
 EditReadOnlyFields 
Set the list of the fields unmodifiable in add and update screens.
Syntax
objVBSdb("EditReadOnlyFields") = "field1;field2;... repeat"
Examples:
objVBSdb("EditReadOnlyFields") = "Product Name;UnitPrice"
objVBSdb("EditReadOnlyFields") = "LastName;FirstName;BirthDate"
Description
Use EditReadOnlyFields to set which edit table fields are to be shown in the add, edit and delete screens. EditReadOnlyFields defaults to the empty string. Il EditReadOnlyFields is empty, then all fields in the edit table are displayed. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "EditReadOnlyFields" ) = "TitleOfCourtesy;HireDate"
%>
On Line Example
A live example of this property can be found here.
 EditAddFieldDefaults 
Set the list of the default values for fields in add screens.
Syntax
objVBSdb("EditAddFieldDefaults") = "field1|default value;... repeat"
Examples:
objVBSdb("EditAddFieldDefaults") = "TitleOfCourtesy|Dr.;Country|USA"
objVBSdb("EditAddFieldDefaults") = "OrderDate|" & date() & ";Freight|0"
Description
Use EditAddFieldDefaults to set the default value for each edit field: it will be applied as initial value for the correspondent input control. To initialize boolean fields, use true and false values.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "EditAddFieldDefaults" ) = "TitleOfCourtesy|Dr."
%>
On Line Example
A live example of this property can be found here.
 EditUpdateFieldDefaults 
Set the list of the default values for fields in update screens.
Syntax
objVBSdb("EditUpdateFieldDefaults") = "field1|default value;... repeat"
Examples:
objVBSdb("EditUpdateFieldDefaults") = "TitleOfCourtesy|Dr.;Country|USA"
objVBSdb("EditUpdateFieldDefaults") = "OrderDate|" & date() & ";Freight|0"
Description
Use EditUpdateFieldDefaults to set the default value for your edit fields in update screens. If you don't set such value explicitly, the default update value will be the current field value in the record to be updated: this is the normal behavior in almost all cases. But some times you may wish to set the field content to a predetermined value: for instance, you may want to register the time of the last record update (in a certain record field). Or you may wish to use a field to store the UserID of the last user who applied a change to the record.
As you can see from the above examples, in most cases you will prefer the user not being able to change the default value for EditUpdateFieldDefaults fields, so you will often set such fields as either EditHideFields or EditReadOnlyFields.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeID,LastName,FirstName,HireDate from Employees"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;update"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeID"
   objVbsDb( "EditUpdateFieldDefaults" ) = "HireDate|" & date()
   objVbsDb( "EditHideFields" ) = "HireDate"
%>
On Line Example
A live example of this property can be found here.
 EditAddSingle 
Instructs VBSdb to add a single record.
Syntax
objVBSdb("EditAddSingle") = boolean
Examples:
objVBSdb("EditAddSingle") = true
objVBSdb("EditAddSingle") = ( request( "addOne" ) = "yes" )
Description
Assume EditAddSingle is set to true (false is the default): VBSdb starts in Add mode: after the new record is added to the edit table (or the user cancels the adding operation) VBSdb displays nothing (the developer will probably decide to display a custom message to the user). This feature allows fast development of input forms for site visitors (for example, to collect user registrations, or to permit site users to submit new resources or to signal new links, and so on).
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName from Products"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "EditValidateRequiredFields" ) = "ProductName|ProductName is required!"
   objVbsDb( "EditAddFieldDefaults" ) = "SupplierId|1;CategoryId|1;discontinued|true"
   objVbsDb( "EditHideFields" ) = "ProductId;SupplierId;Discontinued"
   objVbsDb( "EditAddSingle" ) = true
   VbsDb objVbsDb
   if VbsDbGetLastAction( objVbsDb ) = "SubmitAdd" then
       response.write "<h3 align=center>The new product has been added!</h3>"
   end if
%>
On Line Example
A live example of this property can be found here.
 EditAddScreenRepeat 
Makes VBSdb keep in add mode.
Syntax
objVBSdb("EditAddScreenRepeat") = boolean
Examples:
objVBSdb("EditAddScreenRepeat") = true
objVBSdb("EditAddScreenRepeat") = ( session( "userType" ) = "manager" )
Description
Assume EditAddScreenRepeat is set to true (false is the default): if a new record is added to the edit table, the add new record screen is displayed to the user again. This function is useful when the user is supposed to add many new records when in add mode. If the user clicks the 'cancel' button, then VBSdb returns in view mode.
Note that EditAddScreenRepeat doesn't make VBSdb to start in add mode. To get this goal, set GlobalStartScreen to "add".
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select productId,ProductName from Products"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "EditAddFieldDefaults" ) = "SupplierId|1;CategoryId|1;QuantityPerUnit|1;discontinued|true"
   objVbsDb( "EditReadOnlyFields" ) = "SupplierId;discontinued"
   objVbsDb( "EditAddScreenRepeat" ) = true
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 EditValidateRequiredFields 
Set the list of the fields that cannot contain an empty input value.
Syntax
objVBSdb("EditValidateRequiredFields") = "field1|required message;... repeat"
Examples:
objVBSdb("EditValidateRequiredFields") = "FirstName|First Name cannot be empty"
objVBSdb("EditValidateRequiredFields") = "Product Name|Product Name is empty. Please, insert it."
Description
Use EditValidateRequiredFields to specify that one or more fields cannot be empty. It allows to easily perform a fast client side validation. An error message can be associated to each required field: it will be displayed to the site user, in a javascript pop up message. If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName,CategoryId,SupplierId from products"
   objVbsDb( "GridHideFields" ) = "ProductId;SupplierId"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "EditValidateRequiredFields" ) = "ProductName|ProductName is required"
   VbsDb objVbsDb
%>
On Line Example
A live example of this property can be found here.
 EditValidateRegExp 
Regular Expression validation rules.
Syntax
objVBSdb("EditValidateRegExp") = "field1|regular expression1|error message1;... repeat"
Examples:
objVBSdb("EditValidateRegExp") = "UnitsInStock|[0-9]{1,4}|UnitsInStock is not an integer!"
objVBSdb("EditValidateRegExp") = "EMail|.{1,}@.{1,}\..{2,}|EMail is not a valid e-mail"
Description
Use EditValidateRegExp to specify that one or more fields must be client side validated agains Javascript regular expression rules. This property allows to easily perform sophisticated client side validation. An error message is associated to each validated field: it will be displayed to the site user, in a javascript pop up message, if the input data does not satisfy the regular expression rule. Using this property is extremely simple to impose that a given field input value has to be either numeric or an email (see the examples above), and other similar constraints. If a field name contains spaces, write it without brackets.
To learn more about Javascript regular expressions, you are invited to query search engines for "Javascript regular expression documentation". At the time we write this documentation, you can find a good reference here, but please be aware that pages containing this kind of information are often moved within the containing sites.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName,UnitsInStock from products"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "EditFields" ) = "ProductName;UnitsInStock"
   objVbsDb( "EditAddFieldDefaults" ) = "ProductName|myProduct;UnitsInStock|2a2;"
   objVbsDb( "EditValidateRequiredFields" ) = "ProductName|ProductName is required"
   objVbsDb( "EditValidateRegExp" ) = "UnitsInStock|[0-9]{1,4}|UnitsInStock is not an integer!"
%>
On Line Example
A live example of this property can be found here.
 EditErrorMessages 
Set which error are to be displayed if editing errors arise.
Syntax
objVBSdb("EditErrorMessages") = string. Accepted values are "default" (the default value) and "custom" (case insensitive).
Examples:
objVBSdb("EditErrorMessages") = "default"
objVBSdb("EditErrorMessages") = "custom"
Description
When VBSdb tries either to add, update, or delete a record, some database error may arise. The developer can avoid by design most of such errors, but some may be generated by an attempt to violate some database constraint (most common are unique index constraints and foreign key constraints) and then can be trapped only when the database editing is attempted.
In such cases, the developer may wish to present the site visitor with a user friendly message (for instance, something like "Sorry, the Product you are trying to insert already exists"). The EditErrorMessages property allows the developer to accomplish this.
By default, VBSdb is instructed to trap detailed edit error messages and to pass them to the developer. But once the debug phase is completed, it would be the case to replace such very informative, but technical, messages with some more user friendly warning.
To get it, simply set EditErrorMessages to 'custom' and then customize the three possibly generated database edit error messages, by means of the GlobalCustomText property:
  • the addErrorMessage text item represents the message to be displayed if a database constraint is violated trying to add a new record
  • the updateErrorMessage text item represents the message to be displayed if a database constraint is violated trying to update an existing record
  • the deleteErrorMessage text item represents the message to be displayed if a database constraint is violated trying to delete an existing record
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Categories"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "GridHideFields" ) = "CategoryId;Picture"
   objVbsDb( "FormHideFields" ) = "Picture"
   objVbsDb( "EditTableName" ) = "Categories"
   objVbsDb( "EditKeyFields" ) = "CategoryID"
   objVbsDb( "EditErrorMessages" ) = "custom"
   objVbsDb( "GlobalCustomText" ) = "addErrorMessage|This CategoryName already exists.;" & _
                                                       "updateErrorMessage|This CategoryName already exists.;" & _
                                                       "deleteErrorMessage|There are products in this Category."
   objVbsDb( "EditHideFields" ) = "Picture"
   objVbsDb( "EditAddFieldDefaults" ) = "CategoryName|Beverages"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   VbsDb objVbsDb %>
On Line Example
A live example of this property can be found here.
 EditMemoFields 
Set the list of the fields that are to be displayed as text area in edit screens.
Syntax
objVBSdb("EditMemoFields") = "FieldName|EditModeNumRows|EditModeNumCols|EditModeMaxChars; repeat..."
Examples:
objVBSdb("EditMemoFields") = "Notes|6|45|1000"
objVBSdb("EditMemoFields") = "Product Description"
Description
Use EditMemoFields to specify that one or more fields are to be displayed as text area in add and in update screens. Parameters have the following meaning:
  • EditModeNumRows: denotes the number of rows of the displayed text area
  • EditModeNumCols: denotes the number of columns of the displayed text area
  • EditModeMaxChars: denotes the maximum number of characters accepted as input. If this parameter is given, a readonly text input box is displayed, containing a counter of residual allowed characters. A javascript program updates such counter, each time a key is pressed.
If a field name contains spaces, write it without brackets.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,Title,BirthDate from Employees"
   objVbsDb( "GridFields" ) = "LastName;FirstName;BirthDate"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Employees"
   objVbsDb( "EditKeyFields" ) = "EmployeeId"
   objVbsDb( "EditFields" ) = "LastName;FirstName;Birthdate"
   objVbsDb( "EditMemoFields" ) = "Notes|6|45|1000"
%>
On Line Example
A live example of this property can be found here.
 EditAddTemplate 
Set an HTML template file for the Add screen.
Syntax
objVBSdb("EditAddTemplate") = virtual path to the template file
Examples:
objVBSdb("EditAddTemplate") = "myTemplate.htm"
objVBSdb("EditAddTemplate") = "../templates/products.htm"
Description
Use EditAddTemplate to fully customize the Add screen layout. The following VBSdb tags are recognized:
  • <VbsDbFieldValue>: begins a field name. The field name must be ended by the </VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the input control corresponding to the field. Spaces between the field name and the tags are discarded.
  • </VbsDbFieldValue>: ends a field name. The field name must be preceded by the <VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the input control corresponding to the field. Spaces between the field name and the tags are discarded.
  • <VbsDbInputSubmit>: represents the add screen Submit button. If <VbsDbInputSubmit> is found in the template file, it is substituted with the submit button for the add form.
  • <VbsDbInputReset>: represents the add screen Reset button. If <VbsDbInputReset> is found in the template file, it is substituted with the reset button for the add form.
  • <VbsDbInputCancel>: represents the add screen Cancel button. If <VbsDbInputCancel> is found in the template file, it is substituted with the cancel button for the add form.
For better understanding the template syntax and semantics, please have a look at the following template example.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;removeFilter;search;add"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditAddTemplate" ) = "EditAddTemplateExample.htm"
   objVbsDb( "GlobalStartScreen" ) = "Add"
   VbsDb objVbsDb
%>
Template file example
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
    <TR>
       <TD align=right>Product Name:</TD>
       <TD colSpan=3 align=left><VbsDbFieldValue>ProductName</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Quantity per Unit:</TD>
       <TD><VbsDbFieldValue>QuantityPerUnit</VbsDbFieldValue></TD>
       <TD align=right>Units in Stock:</TD>
       <TD><VbsDbFieldValue>UnitsInStock</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Units on Order:</TD>
       <TD><VbsDbFieldValue>UnitsOnOrder</VbsDbFieldValue></TD>
       <TD align=right>Reorder Level:</TD>
       <TD><VbsDbFieldValue>ReorderLevel</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right> Discontinued:</TD>
       <TD><VbsDbFieldValue>Discontinued</VbsDbFieldValue></TD>
       <TD align=right>Unit Price:</TD>
       <TD><VbsDbFieldValue>UnitPrice</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=center colspan=4><VbsDbInputSubmit> <VbsDbInputReset> <VbsDbInputCancel></TD>
    </TR>
</TABLE>
On Line Example
A live example of this property can be found here.
 EditUpdateTemplate 
Set an HTML template file for the Update screen.
Syntax
objVBSdb("EditUpdateTemplate") = virtual path to the template file
Examples:
objVBSdb("EditUpdateTemplate") = "myTemplate.htm"
objVBSdb("EditUpdateTemplate") = "../templates/products.htm"
Description
Use EditUpdateTemplate to fully customize the Update screen layout. The following VBSdb tags are recognized:
  • <VbsDbFieldValue>: begins a field name. The field name must be ended by the </VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the input control corresponding to the field. Spaces between the field name and the tags are discarded.
  • </VbsDbFieldValue>: ends a field name. The field name must be preceded by the <VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the input control corresponding to the field. Spaces between the field name and the tags are discarded.
  • <VbsDbInputSubmit>: represents the update screen Submit button. If <VbsDbInputSubmit> is found in the template file, it is substituted with the submit button for the update form.
  • <VbsDbInputReset>: represents the update screen Reset button. If <VbsDbInputReset> is found in the template file, it is substituted with the reset button for the update form.
  • <VbsDbInputCancel>: represents the update screen Cancel button. If <VbsDbInputCancel> is found in the template file, it is substituted with the cancel button for the update form.
  • <VbsDbExecute>, </VbsDbExecute>, <VbsDbFieldParameter> and </VbsDbFieldParameter>. These four tags are used for more sophisticated field value's formatting. They allow you to apply VBScript server side functions to the field values for the record to be updated (for instance, they allow you to set up conditional formatting functions).
    To see the full documentation for these four tags, you are invited to check the GridTemplate documentation.
For better understanding the template syntax and semantics, please have a look at the following template example.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "Sql" ) = "select * from products"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;removeFilter;search;add;update"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductID"
   objVbsDb( "EditUpdateTemplate" ) = "EditUpdateTemplateExample.htm"
   VbsDb objVbsDb
%>
Template file example
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
    <TR>
       <TD align=right>Product Name:</TD>
       <TD colSpan=3 align=left><VbsDbFieldValue>ProductName</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Quantity per Unit:</TD>
       <TD><VbsDbFieldValue>QuantityPerUnit</VbsDbFieldValue></TD>
       <TD align=right>Units in Stock:</TD>
       <TD><VbsDbFieldValue>UnitsInStock</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Units on Order:</TD>
       <TD><VbsDbFieldValue>UnitsOnOrder</VbsDbFieldValue></TD>
       <TD align=right>Reorder Level:</TD>
       <TD><VbsDbFieldValue>ReorderLevel</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right> Discontinued:</TD>
       <TD><VbsDbFieldValue>Discontinued</VbsDbFieldValue></TD>
       <TD align=right>Unit Price:</TD>
       <TD><VbsDbFieldValue>UnitPrice</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=center colspan=4><VbsDbInputSubmit> <VbsDbInputReset> <VbsDbInputCancel></TD>
    </TR>
</TABLE>
On Line Example
A live example of this property can be found here.
 EditDeleteTemplate 
Set an HTML template file for the Delete screen.
Syntax
objVBSdb("EditDeleteTemplate") = virtual path to the template file
Examples:
objVBSdb("EditDeleteTemplate") = "myTemplate.htm"
objVBSdb("EditDeleteTemplate") = "../templates/products.htm"
Description
Use EditDeleteTemplate to fully customize the Delete screen layout. The following VBSdb tags are recognized:
  • <VbsDbFieldValue>: begins a field name. The field name must be ended by the </VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with field value. Spaces between the field name and the tags are discarded.
  • </VbsDbFieldValue>: ends a field name. The field name must be preceded by the <VbsDbFieldValue> tag. If <VbsDbFieldValue>FieldName</VbsDbFieldValue> is found in the template file, it is substituted with the field value. Spaces between the field name and the tags are discarded.
  • <VbsDbInputSubmit>: represents the delete screen Submit button. If <VbsDbInputSubmit> is found in the template file, it is substituted with the submit button for the delete form.
  • <VbsDbInputCancel>: represents the delete screen Cancel button. If <VbsDbInputCancel> is found in the template file, it is substituted with the cancel button for the delete form.
  • <VbsDbExecute>, </VbsDbExecute>, <VbsDbFieldParameter> and </VbsDbFieldParameter>. These four tags are used for more sophisticated field value's formatting. They allow you to apply VBScript server side functions to the field values for the record to be deleted (for instance, they allow you to set up conditional formatting functions).
    To see the full documentation for these four tags, you are invited to check the GridTemplate documentation.
For better understanding the template syntax and semantics, please have a look at the following template example.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from products"
   objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;removeFilter;search;add;update;delete"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductID"
   objVbsDb( "EditDeleteTemplate" ) = "EditDeleteTemplateExample.htm"
   VbsDb objVbsDb
%>
Template file example
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
    <TR>
       <TD align=right>Product Name:</TD>
       <TD colSpan=3 align=left><VbsDbFieldValue>ProductName</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Quantity per Unit:</TD>
       <TD><VbsDbFieldValue>QuantityPerUnit</VbsDbFieldValue></TD>
       <TD align=right>Units in Stock:</TD>
       <TD><VbsDbFieldValue>UnitsInStock</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right>Units on Order:</TD>
       <TD><VbsDbFieldValue>UnitsOnOrder</VbsDbFieldValue></TD>
       <TD align=right>Reorder Level:</TD>
       <TD><VbsDbFieldValue>ReorderLevel</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=right> Discontinued:</TD>
       <TD><VbsDbFieldValue>Discontinued</VbsDbFieldValue></TD>
       <TD align=right>Unit Price:</TD>
       <TD><VbsDbFieldValue>UnitPrice</VbsDbFieldValue></TD>
    </TR>
    <TR>
       <TD align=center colspan=4><VbsDbInputSubmit> <VbsDbInputCancel></TD>
    </TR>
</TABLE>
On Line Example
A live example of this property can be found here.
 EditAutoincrement 
Set the edit autoincrement (identity) field.
Syntax
objVBSdb("EditAutoincrement") = ""
Examples:
objVBSdb("EditAutoincrement") = "EmployeeID"
objVBSdb("EditAutoincrement") = "ID"
Description
EditAutoincrement identifies the autoincrement field (if any) in the Edit table. You should never need to use this property, because VBSdb implements several algorithms to detect if a field is of autoincrement type. Would it be the case your application doesn't detect properly the edit read only fields, instruct VBSdb explicitly setting EditAutoincrement with your edit table autoincrement field.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName,CategoryId,SupplierId from products"
   objVbsDb( "GridHideFields" ) = "ProductId;SupplierId"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditAutoincrement" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
%>
On Line Example
A live example of this property can be found here.
 EditFormTamperingControl 
Instructs VBSdb to check for Form Tampering.
Syntax
objVBSdb("EditFormTamperingControl") = boolean. Default is true.
Examples:
objVBSdb("EditFormTamperingControl") = false
objVBSdb("EditFormTamperingControl") = ( session( "user" ) <> "admin" )
Description
Form tampering is an hacking technique that allows the skilled visitor to:
  • copy the html of the produced page and copy it locally
  • change the local page
  • submit the tampered form from the local page
To make an example, assume you build a market place. Of course you give a producer only the chance to modify its products. If you use a database component, the solution will almost surely be that the ProductId is written in an hidden control in the update form. Well, the malicious producer, may copy the page locally, replace the ProductId with the ProductId identifying a product manufactured by an other producer and submit the form. This way, the malicious producer will be able to modify the price for a competitor's product.
When EditFormTamperingControl is set to true, VBSdb automatically performes the following form tampering controls:
  1. A submitted Add, a submitted Update or a submitted Delete is actually performed only if the corresponding actions are enabled by the VBSdb object definition (for instance, if an Add is submitted VBSdb checks that the Add button is listed in the navigation bar).
  2. A submitted Update or a submitted Delete is actually performed only if the edited record would be listed in the Grid (this control prevents from the above example where a producer changes the competitor's product price). This control is performed only if the Sql property is assigned with a select statement (it is not performed if the Sql property is assigned with a stored procedure).
  3. When a field value has to be chosen by a drop down control (InputSelectFields and InputEnumeratedFields), the record is actually edited only if the submitted value is actually listed in the produced drop down.
When EditFormTamperingControl is set to false, controls 2. and 3. are not performed. So you can set this property to false when form tampering is not an issue (for instance, if you are not in a multiuser environment). This way, you will speed up the updates.
Code example
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select ProductId,ProductName,CategoryId,SupplierId from products"
   objVbsDb( "GridHideFields" ) = "ProductId;SupplierId"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "EditFormTamperingControl" ) = false
%>
On Line Example
A live example of this property can be found here.