|
I. Introduction
ASP-db™ is the first ASP component that has been designed to provide an easy and yet powerful way to display ODBC databases on a web page. In creating ASP (Active Server Pages), Microsoft has set a new standard for developing powerful dynamic HTML applications and web pages. To many seasoned programmers, web programming presents a difficult new challenge due to the primitive nature and "stateless" operation of the web development environment. In many web applications, database viewing represents a significant percentage of the development effort. ASP-db™ allows a web page developer to handle this complicated function with minimum of code in a matter of minutes. If you are a programmer who is barely familiar with the ASP environment, you may use the ASP-db™ examples as templates to construct entire ASP web pages quickly. For example, with ASP-db™ an entire database viewing application for a database with 120 fields and 2000 records can be written in only 3 lines of code!
ASP-db™ (also known as ASP-db View) includes the following files:
· ASPdbView-Eval.dll (Evaluation version, limited to 100 records) or
· ASPdbView-Local.dll (for use on a Windows 95 or Windows NT Workstation) or
· ASPdbView-Server.dll (for use on a Windows NT Server, includes a copy of ASPdbView-Local.dll)
· ASPdb.DOC (this documentation file in MS Word 6.0/95 format)
· ASPdb.HTM (this documentation in HTML format)
· vb5db.dll (if you can not register ASP-db, you may need to put this dll in your path)
· asp-test.asp, asp-test.mdb (Sample ASP source files and a database for testing)
· readme.txt file which contains last minute tips and instructions not necessarily included in the DOC file
· *.gif (Sample Navigation Bar buttons. These 29 files are in a "\images" subdirectory and should be placed in an “images” subdirectory beneath the supplied asp-test.asp file for proper operation.) The location of this directory is specified with the dbImageDir property.
ASP-db Pro™ is an optional upgrade to ASP-db View which gives the capablity for database updates to be performed by the clients. This is an extra cost upgrade which is a "superset" of ASP-db View. ASP-db Pro™ includes the files found above (except the ASPdbView dll's) plus:
· readme-pro.txt file which contains last minute tips and instructions not necessarily included in the DOC file
· ASPdbPro-Local.dll (for use on a Windows 95 or Windows NT Workstation)
· ASPdbPro-Server.dll (for use on a Windows NT Server, includes a copy of ASPdbPro-Local.dll)
Overview of how ASP-db™ works:
ASP-db™ is an Active-X server-side component. It is designed to be installed on a Microsoft web server. Once installed, any ASP file on that server can “call” ASP-db. When its “ASPdbView” method is called, it will open and read any ODBC data source, and output it as standard HTML, either as a grid, form, or combination of the two. Below is a basic description of how using ASP-db, the information gets from the server to the end-user’s browser:
1) The .ASP file (web page) is requested by the end-user from their browser.
2) The web server reads the .ASP file and “passes the commands between <% and %> through” the ASP interpreter which decodes and executes the ASP. It then encounters the “Create Object” command for the ASP-db™ object. The server loads the ASP-dbView dll into memory (if it’s not already loaded).
3) All of the properties of the ASP-db™ object (i.e. MyDb) are set such as data source, colors, display style, etc.
4) The ASPdbView method is invoked in the .ASP file (e.g. MyDb.ASPdbView).
5) ASP-db™ reads from the data source, and outputs it as HTML to the end-user’s browser.
6) The rest of the .ASP page (including the programmer’s standard HTML code) is displayed to the user’s browser and the cycle is complete.
7) Each time the end user clicks on one of ASP-dbView’s buttons, the page is redisplayed with the “requested command” passed as a parameter in the URL address (e.g. myfile.asp?But=gridNext::10).
II. Installation
Overview:
Installation consists of:
1) Unzipping the asp-db.zip file that was delivered to you into a separate folder
2) Stamping the dll with your serial number and company name (not necessary if it has already been done by MMS)
3) Registering the dll
4) Runing the simple test program to be sure that everything is working OK
It is important to understand that ASP-db™ only needs to be installed once on your web server. Each end-user, whether on an Intranet, or the Internet does not need to have it installed on their machine. Because it runs on the web server and outputs standard HTML, it doesn’t require any special software or installation on end-user’s machines. As far as they can tell, the web server has simply sent them a standard HTML page.
ASP-db™ also ships with a “developer” version of the software. The purpose of this copy is for use on stand-alone machines that do not have access to a network where the full server version is installed. An example of this might be a notebook computer running Personal Web Server (PWS) 4.0 on Windows 95. With the developer copy installed on this machine, one would have a complete standalone development and testing station that does not require being attached to a network whatsoever.
Installation Details:
Before ASP-db™ can be used in a web page application, you must install and register the DLL on your Microsoft web server. To do this, first copy the DLL onto your web server’s hard drive. Please be sure that the directory has read and execute rights.
You may then install and register ASP-db™ in one of two ways.
Registering from MTS (MicrosoftTransaction Server) - Preferred Method
You can create a Package & Component in the Microsoft Transaction Server with the MMC (Microsoft Management Console).
1) Open Microsoft Transaction Server
2) Open Computers
3) Open My Computer
4) Open Packages Installed
5) Left click on Packages Installed
6) Choose NEW PACKAGE from the popup menu
7) Click on Create an Empty Package
8) Type in a name, such as ASP_Stuff
9) Click Next then choose either Interactive or This User & FINISH.
10) Open up your "ASP_Stuff" package
11) Left click on Components, then right click on it and...
12) Choose NEW COMPONENT
13) Click on Install new component
14) Click on Add Files and choose the ASPdbView-Server.dll file that you wish to register.
15) Click the Finish button.
For additional information, refer to the MTS on-line documentation for details on creating a package and a component.
Registering from a DOS prompt
First open a DOS prompt. Then, change to the directory where the dll was installed, and type:
REGSVR32 ASPdbView-Server.dll (substitute your .dll name if different, i.e. ASPdbView-Local.dll)
IMPORTANT! If you register ASP-db™ in this way, you must Unregister it before installing a newer version. Unregistering ASP-db™ is done in a very similar manner, except at the DOS prompt, you must type:
REGSVR32 /U ASPdbView-Server.dll (substitute your .dll name if different, i.e. ASPdbView-Local.dll)
Note: If you get a message like “Bad command or file name” it is probably because the REGSVR32 program is not in your path. Try to locate the program REGSVR32.EXE on your C drive and add that folder to your path. Or if REGSVR32 is not in your path, you might try typing:
\Windows\System\REGSVR32 ASPdbView-Server.dll
Notes on Evaluation Copy
If you are using the evaluation version or ASP-db™ (ASPdbView-Eval.dll), note that it will work on NT Server, NT Workstation and Windows 95. It is a fully functional version and has an advertising banner and a limitation of displaying a maximum of 100 records at one time. Your data source can have more records, but only 100 records will be shown at any time.
Installation Problems:
Please refer to the Troubleshooting Section for a list of suggestions on resolving problems installing, registering, or debugging your ASP-db™ applications.
III. Getting Started
To see how ASP-db™ works, and to test for a successful installation, we suggest you use a simple ASP program to exercise ASP-db™. Try running one of the sample ASP files provided or use the following sample file (use your own Database and Table name):
<HTML>
<BODY>
<CENTER>
Welcome to an ASP-db™ Test Page.<P>
<%
Set MyDb = Server.CreateObject("ASPdb.View") ' Create the ASP-db™ object
MyDb.dbMDB = Server.MapPath("YourFile.mdb") ' Use YourFile.mdb in the current directory
MyDb.dbColor = "7,auto" ' Pick color scheme 7, turn on Color button
MyDb.dbMode = "dual" ' Show it in both "grid" and "form" mode
MyDb.dbGridTableTag = "BORDER=3" ' Set the table BORDER to 3
MyDb.dbSQL = "Select * FROM YourTable" ' Select which table to show
MyDb.ASPdbView ' Tell ASPdbView to show the table!
%>
</CENTER>
</BODY>
</HTML>
The general form for usage is to:
· first create an object and give it a name, such as MyDb.
Example: Set MyDb = Server.CreateObject("ASPdb.View")
· specify the database name, such as inventory.mdb.
Example: MyDb.dbMDB = Server.MapPath("inventory.mdb")
· optionally over-ride any of the defaults that you want to change (color, borders, etc.)
Example: MyDb.dbColor = "7,auto"
· specify a table name and query criteria
Example: MyDb.dbSQL = "Select * FROM [Shoes]"
Note: Brackets [ ] around field names and table names are optional and are only required when they contain space(s).
· and finally, display the data.
Example: MyDb.ASPdbView
Details on these commands can be found in the following section.
IV. Reference Section - Both ASP-db View and ASP-db Pro
Note: There are several properties and functions that apply only to ASP-db Pro, the optional dll which allows users to edit records in your databases. Those properties will be clearly marked in this documenation as "PRO version only".
a. Display Modes
There are two distinct display modes: Grid and Form.
Basic display modes:
Grid - This is the normal display mode in HTML "table" format. The field names are displayed in the top header row and the field values are displayed in the rows below the header. In the situation where there are a small number of fields, you can display more data without scrolling by using the multiple grid (grid+/grid-) mode. In this format, the grid will be "wrapped" to additional columns.
Form - This format displays only one record at a time with the field names displayed in the left column, and the field contents displayed in the right column. This format can be used to display a large number of fields with a minimum amount of horizontal scrolling. Additionally, a multiple column feature (Form+, Form-) allows columns to "wrap", minimizing the amount of vertical space required. This wrapping is very useful when a large number of fields are to be displayed.
Combination display modes:
Dual, Dual-horiz - When a table has a large number of fields (250 for example), it would be impractical to display all 250 fields horizontally. Using the Form mode (with column wrapping) can allow you to view all of the fields simultaneously. However, you are limited to viewing and navigating only one record at a time. There is a more elegant method of display that solves this problem known as “Dual” (and “Dual-horiz”) mode. In Dual mode, you would display a small number of key fields in Grid mode and display the rest of the row data one record at a time in Form mode. You could then click on a row in the Grid to select your record, and then see all of the row detail on the Form. The only difference between Dual and Dual-horiz is that Dual mode displays the Form below the Grid and Dual-horiz displays the Form to the right of the Grid.
Both - In this display mode, the Grid would be displayed with record numbers in the first column. Clicking on one of the record numbers toggles the display to Form mode and displays that record. You can remain in this view mode and navigate through the records one at a time with the Next / Prev buttons, or can click on the Grid button to toggle back to Grid mode. When screen space is at a premium, and many fields are to be displayed simultaneously, "Both" mode can provide the best of both worlds. It allows the Grid mode for record navigation, and Form mode for detailed viewing of each field.
b. FieldName and FieldNumber
In ASP-db, FieldName and FieldNumber can be intermixed. FieldName is the text name of a field, like “[First Name]”. If the name has embedded space(s), it must be enclosed in brackets. FieldNumber starts at “0” and corresponds to the default field sequence. The following examples show a few possibilities:
X.dbFilterFlds = "[Car Name], [Manufacturer], Year, Price, MPG"
X.dbFilterFlds = "0, [Manufacturer], Year, 3, MPG"
X.dbGridHideFlds = "0, 1, 2, 3, 7"
Notes:
If a field name has been changed using the dbNameMap property, you should use whatever the name of the field was, before it was redefined in dbNameMap.
For best results, avoid using field names with special characters in them. For example, if you want a column name to contain a question mark (?), such as "PromoItem?", just call it PromoItem in your database and use the dbNameMap property to change the way it will appear on the display. Example: xx.dbNameMap="PromoItem,PromoItem?". Special characters, especially the question mark, are confusing to the system's ODBC SQL and UPDATE statements and unpredictable things may happen.
c. Properties
Properties are used to specify the database and display format. The general form is:
Mydb.Property = “string_value” or numeric_value or boolean value
Note: All property names and values are case insensitive. Following are three tables with a detailed description of each property. The first two tables apply to both the View and Pro versions. The third table applies to the Pro Version Only. At the end of the three tables is some Additional Discussion of Selected Properties.
REQUIRED Properties - Both View and Pro Versions
Properties
Values
Purpose / Example
dbDSN
(Either dbDSN, dbDAT, dbMDB, or dbRecordSet is required))
ODBC system or File DSN
Define the Data Source Name for the ODBC Database
X.dbDSN="nwind"
X.dbDSN="FileDSN=..."
Example:
X.dbDSN="DSN=NWIND; UID=sa; PWD=secret;"
In fact, dbDSN can be used to input anything the user wants, such as:
X.dbDSN="DBQ = d:\database\userlogin.mdb; _
defaultdir=c:\database; _
driverId=25; Fil=MSACCESS; _
ImplicitCommitSync=Yes; _
MaxBufferSize=512; MaxScanRows=8; _
PageTimeOut=5; SafeTransactions=0; _
Threads=3; UID=admin; UserCommitSync=Yes;"
See the Additional Discussion section below for more details.
dbMDB
(Either dbDSN, dbDAT, dbMDB, or dbRecordSet is required))
Full Path of MS ACCESS .mdb file
Specify the full physical pathname of an ACCESS mdb file
X.dbMDB="d:\asp\prog\cardb\ImageDB.mdb"
X.dbMDB=Server.MapPath(“ImageDB.mdb”)
dbDAT
(Either dbDSN, dbDAT, dbMDB, or dbRecordSet is required)
MS-SQL database –
Server, DB, UID, PWD
X.dbDAT=”mySQLsvr, NWINDdb, sa”
dbRecordSet
(Either dbDSN, dbDAT, dbMDB, or dbRecordSet is required))
RecordSet object handle
User opens a Data Source and passes a RecordSet Object instead of setting the dbMDB or dbDSN parameters.
DSNname =
"driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("asp-test.mdb")
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "Select * from [Products]", DSNname, 3,1,1
X.dbRecordSet = RS
dbSQL
SQL query statement.
Selects the table, query and any filters from the data source (dbDSN or dbMDB)
X.dbSQL="Select Car, Manufacturer, Year, Price, picture FROM carspecs WHERE Year > 1997"
See the Additional Discussion section below for more details.
OPTIONAL Properties - Both View and Pro Versions
Properties
Values
Purpose / Example
dbBLOB
FieldNameOrNumber, BLOB_Context_Type, Replacement_Text, BLOB_Offset
Setup cell text replacement and also display option for data type 205 (long Binary or BLOB). Set Offset to –1 to disable hyperlinking.
X.dbBLOB="Photo,image/bmp,Employee Picture,78"
X.dbBLOB="Photo,,Employee Picture,-1"
dbBoolText
True_text, False_text
Replaces the default Boolean text (True/False) with customized text of your choice.
X.dbBoolText = "Y,N" or "Male,Female" or "x, "
dbButtonAnchor
Boolean
(default=True)
Setting this property to false prevents anchors from being generated and referenced whenever navigation buttons are hit (next, previous, filter, etc). The purpose of button anchors ( URL = … #ASBDB_unitno ) is to put your browser display at or at least near the navigation buttons whenever vertical scrolling is necessary. However, in some instances, this automatic positioning may be undesirable.
Example:
X.dbButtonAnchor = false
dbColGraph
TableName, FieldNameNumber, Width, Height Icon, Style, Min, Max
Displays any numeric field as a horizontal bar chart in both grid and form mode. See the Additional Discussion section below for more details.
Important: In order for this property to work, you must set the dbImageDir property.
X.dbColGraph="carspecs,price,200,,bluebar.gif,8;"
dbColor
Option 1: User defined color set:
TableBG, HeaderFG, HeaderBG, TDFG, horizontal stripes
Option 2: Predefined color set:
Index, Auto, Hstrip, Vstrip
Option 1:
Define the user preferred custom table colors: Table Data BG, Header FG, Header BG, Table Data FG. There are fifteen preset color schemes (1-15). (the fifth parameter is optional)
X.dbColor="30E0E0,000000,FF8080,000030"
Option 2:
System control options.
X.dbColor="15,,lightgrey"
X.dbColor="3,auto,,lightyellow"
Hint: Use light colors for horizontal and vertical H/V strips. If both hoizontal AND vertical stripes are defined, the horizontal stripes will be dominant.
dbCSVDelimiter
String
Defines the delimiter character(s) used between fields when the "Download" button is pressed.
Default = chr(9)
DbCSVDelimiter = ","
dbCSVDelimiter = chr(13) + chr(10)
dbCSVName
String
Name that will be given to the file which is downloaded when the Download button is pushed. Default is "ASPdb.CSV".
dbDownloadHideFlds
FieldNames or FieldNumbers
Use this to prevent certain field(s) from being downloaded when the user clicks the Download button..
dbEasyFilterText
Boolean
(default=True)
If set to true, ASP-db™ will replace all “*” wildcard characters with “%” (the standard SQL wildcard character). Also, if “%” symbols are not used around the filter text, ASP-db™ will insert them for you.
Default=True.
This property has been replaced with dbFilterParams.
dbExportFlds
FieldNames or FieldNumbers
Specify which database fields should be exported into session variables whenever a record is selected. The contents of the field for the selected record are placed in a variable named: ASPdb_n_FieldName where n is the DbUnit number, such as 2 and FieldName is the name of the database field, such as City. In this case, the session variable name would be ASPdb_2_City.
dbExportFlds = “fld1, fld2, fld3, ...”
Example: dbExportFlds = “0,City,3,Zip”
dbFilterDropFlds
FieldName,
Connection,
Table Name,
FieldName;
repeat as necessary.
Create a drop down filter list for this field(1). The content of drop down box will be a SELECT DISTINCT of the specified field (4) from the specified table (3) of the specified datasource(2). Connection (datasource) may be of the form “DSN=xxx”, MDB=xxx.mdb” or “DAT=server+database+UID+PWD”. Text and number fields are supported while memo, Binary, and OLE Object fields are ignored. A simple example of one drop down list to be used with a grid showing managers in a personnel file:
X.dbFilterDropFlds="City,MDB=people.mdb,managers, City"
Optionally, you can define the delimiters by listing them at the beginning and putting them inside parenthesis. (See Delimiter Definitions in the Additional Discussion section below.)
For example, say you have a personnel database with gender, city, and hair color:
X.dbFilterDropFlds="(;,/)0,MDB=people.mdb, managers,0;
1,MDB=people.mdb, managers,1;
2,,,Black/Brown/Blond/Other”
Note that when specifing your own list entries or when the datasource is the one already open, you do not need to provide the datasource name.
The simplest (and most common) example is:
X.dbFilterDropFlds = “State,,Personnel,State”
This would present a drop down list for the field called State and use all the states found in the State field of the Personnel table of the open data file.
See the Discussion section below form more details.
dbFilterFlds
Query FieldNames or FieldNumbers.
Defines which fields are displayed when the Filter button is pressed. This property applies to both grid and form styles. Supply these FieldNames or FieldNumbers to construct the recordset filter. No validation check is performed on these fields when supplied by user. Default is all of the fields less the OLE Objects (type 205).
X.dbFilterFlds="car,1, price"
Optionally, you may specify an alternate page heading, instead of the typical:
Filter Recordset in (Select * FROM [Table1])
You may also specify a "simple" style of filter screen, which will not contain the AND and OR buttons or the drop-down lists of comparison operators.
X.dbFilterFlds = "car, price, heading=Choose a Car Now, style=simple"
dbFilterHideFlds
FieldNames or FieldNumbers to be omitted from filter.
This property allows you to hide fields from being displayed when the Filter button is pressed. Only effective when dbFilterFlds is not used.
X.dbFilterHideFlds="0, City, 8”
dbFilterParams
String
dbFilterParams = "TableTag=Border=1, EasyFilterText=False, ApplyButtonText=My Text, DropButtonText=Toggle the Drop Lists"
Use ApplyButtonText if you want to define your own text for the ApplyFilter button.
Use DropButtonText if you want to define your own text on the button which toggles (on and off) the use of filter drop-down lists. Use DropButtonText=none to hide the toggle button. Default="DropDown ?"
If EasyFilterText is set to true (the default), ASP-db™ will replace all “*” wildcard characters with “%” (the standard SQL wildcard character). Also, if “%” symbols are not used around the LIKE filter text, ASP-db™ will insert them for you. If EasyFilterText is set to false, it will up to the user to specify all correct syntax, including single quotes.
dbGridColSort
Boolean
(default=True)
Enable/Disable Field column sort.
dbGridCol
dbFormCol
String
“Number, auto”
Number of Columns of grids and/or forms. Default = “1,Auto”. RowSpan will be disabled when FormCol>1. If Auto is specified then navigation buttons will be available. If only the number is specified then the column number will be fixed and the Grid+/Form+ buttons will not be available.
X.dbGridCol=”2,Auto”
X.dbFormCol=”3,Auto”
dbGridColSortHideFlds
FieldNames or FieldNumbers.
Suppress column sorting of the fields specified.
Example: dbGridColSortHideFlds=”2,4”
dbGridDisplayFlds
dbFormDisplayFlds
FieldNames or FieldNumbers.
Define which fields are displayed. Default = all
X.dbGridDisplayFlds = “0, 2, 3, 4, 5, price”
Note: Do not use this if dbGridHideFlds is used
If dbFormDisplayFlds = -1, then NO fields will be shown on the form (although Memo fields WILL be shown).
dbGridHideDuprecFlds
FieldNames or FieldNumbers.
This causes cells to appear blank when consecutive records have identical contents. It gives a very nice appearance as if records were being grouped together.
dbGridHideFlds
dbFormHideFlds
FieldNames or FieldNumbers.
Define which fields are hidden. Default = none.
X.dbGridHideFlds = “6, 7, price”
Note: Do not use this if dbGridDisplayFlds is used
dbGridInc
integer
Sets the number of grid rows to display. The number defines both the initial number of rows and the number of rows to increase each time the Row+ button is clicked. Default=5. Note: If dbGridInc = -1 then GridInc = 999,999,999
X.dbGridInc=5
dbGridIndex
Boolean
(default=True)
Creates a column on your grid which can be used to hyperlink to that record and show it in a form mode. This property will be disabled when dbMode="grid".
X.dbGridIndex=true
dbGridTableTag
dbFormTableTag
<TABLE ...tags....>
Options that goes into the <TABLE …> tag
X.dbGridTableTag="BORDER=1 CELLPADDING=2"
dbGridTHBGtag
dbFormTHBGtag
<TR ... tags ...>
Option tags that apply to the <TR . .> tag for the column headers row.
X.dbGridTHBGtag="Align=Center”
dbFormMemo
[RxC],field1,..fieldn
Display memo field(s) in a separate text area. The text area size, Row x Col, is optional. Default=10 x 50. Fields can be either numbers or text.
X. dbFormMemo ="15x70,User Comments"
X. dbFormMemo ="8,9" (field 8 and 9, uses default size of 10x50)
dbHeader
Boolean
(default=True)
Controls whether or not the entire "Header" row will appear above the grid. If false, then only the data itself will appear. Default = true
X.dbHeader=false
dbHeading
String
This property has been replaced with dbOptions.
dbImageDir
String
Defines the directory where the navigation button and column graph images can be found.
Default = “”
Example: X.dbImageDir="images/"
dbLicense
License Information
This is a “read only” property. You can use it to display who the copy of ASP-db™ is licensed to.
Response.write(“License Info is : “ & X.dbLicense)
dbMagicCell
String
Offers almost unlimited control over the format and function of each cell. Three parameters (plus 2 more optional) are used to described the formatting desired for each column. For multiple columns, separate the three parameters with semicolons. The third parameter could specify a full VB_format_string, such as format=[currency].
X.dbMagicCell=”field to apply, Cell_TD_tag, Cell_contents_tag, index, indexanchor; repeat as necessary…”
Example:
Format the first (0th) field of the database to have black Arial font of size 3, center in the column, whose width is 20% of the table. Also make it bold and italics. Format the second field to be green and use the currency format.
X.dbMagicCell=”0,align=center width=20%,<Font Size=3 Face=ARIAL Color=Black> <I><B> #0# </B></I> </Font>;1, , <Font Color=Green> format=[currency]</Font>”
You may optionally override the delimiters used.
See the Additional Discussion section below for more information.
dbMagicDelimiter
String
This property is now obsolete. It has been replaced with “on-the-fly” delimiter definition. (see Delimiter Definitions in the Additional Discussion section below)
For the dbMagicCell and dbNameMap properties, it allows redefinition of the default delimiter characters (";" and ","). This is useful when you need to include the ";" or "," characters in your string of text. Normally dbMagicDelimiter does not need to be used at all. The third and fourth parameters define the delimiters used with the format parameter (see example below).
Default = "; , [ ]" (semicolon, comma, bracket, bracket)
Example:
DbMagicDelimiter = "~/!*"
then dbMagicCell could be:
X.dbMagicCell = "Fname/align=left/#Fname#, #Lname~ #2#//format=!currency*"
dbMemoTextSize
Long
Controls how memo fields are displayed in grid cells.
0 = “Memo” (default shows the word "Memo" in the cell)
-1 = Entire Memo contents is displayed in the cell
n>1 = Show the first 'n' characters in the cell
dbMemoTextSize = 50 (show first 50 chars of memo)
dbMode
grid/form/both/dual/dual-horiz
Define the display mode, default=”grid”.
X.dbMode ="dual"
dbNameMap
field, NewName, TH_Cell_Tags,formula
Redefines the field name(s) for display purposes. Default = the field names from the database. The first parameter is the fieldname in the database. The second parameter is what you want to call that field on the display (grid or form). The third parameter contains html code that you want to have inserted into the <TH … > tag for this cell for the column title. For example:
X.dbNameMap="Fname, First Name,; Lname, Last Name, Align = Center; Car, Make & Model, Span=2"
Note: "Span=2" gets converted to "ColSpan=2".
There is an optional fourth parameter that is used to define a column title for a calculated field. For example, if you have:
X.dbSQL = "Select Unitcost, Qty, (Unitcost*Qty) as Total from Catalog"
You can define a title (TotalCost) for that Total column by using:
X.dbNameMap = "Total,TotalCost,,(Unitcost*Qty)"
You will then be able to sort on that Totalcost column.
dbNavigation
String: none/bottom/top/both
(default = “bottom”)
Set the position of the Navigation bar
X.dbNavigation = “both”
dbNavigationIcon
String: 18 parameters
1=file extension wildcard
2 through 18=Icon filenames
If you specify a file extension wildcard (e.g. gif) in the first parameter, do not include file extensions with the icon filenames that follow. Use full file names with their extensions when your icons are a mix of jpg and gif files.
“std” – to choose the default 17 buttons supplied with the ASP-db package.
Use bitmaps for the Navigation buttons. The position of the items must be in the right order, as follows:
Path, grid, form, top, prev, next, bottom, row+, row-, grid+, grid-, form+, form-, filter, resetfilter, download, color, reload.
There also needs to be a set of the similar bitmaps with a “g_” as prefix (for grayed out) except Filter, ResetFilter, Download and Color. For example, if you have a MyTop.gif you must supply a file called g_MyTop.gif (for the grayed out version of the Top button).
Important: In order for this property to work, you must set the dbImageDir property.
X.dbNavigationIcon="gif, grid, form, top, prev, next, bottom, rowplus, rowminus, gridplus, gridminus, formplus, formminus, filter, resetfilter, download, color, reload"
X.dbNavigationIcon = “std” (shortcut notation for the above example).
dbNavigationItem
top, prev, next, bottom, gridrow, gridcol, formcol, filter, download, color, reload
Defines which Navigation buttons you want displayed.
X.dbNavigationItem="top, next, prev, bottom, filter"
See the Discussion section below form more details.
dbOptions
String
Used to define various options. At the present time, there are several parameters. More may be added in future updates.
Parameters include:
ConnectTimeout, FontSize, DateWrap, GridInitSortDESC, CloseConnection, CellFontTag, HeaderFontTag
See the Discussion section below form more details.
dbQuickProps
dbUnit; data source (dbDSN or dbMDB); [Table Name]; dbMode; dbColor; extension of navigation icons; optional key word "std"
(Note: dbUnit is optional)
Shortcut method of specifying the top 6 properties on one line.
DbQuickProps="1; nwind.mdb; [Customers]; grid; 7,auto,lightgrey; gif; std
Notes: The parameters are separated with semicolons. If "std" is specified for the optional (last) parameter, it is equivalent to setting dbNavigationIcon = "std". If this is used, the dbImageDir property must be set.
Use “*” for Table Name to browse through all Tables in the database.
dbRecordCount
Long
Pre-determined record count of database. Setting this property will greatly enhance the speed of the initial data access (4x) and should be used whenever possible.
X.dbRecordCount=3244
dbSelectBox
Size, TitleText, ButtonText; MagicOption
The dbSelectBox is useful in a "dual" or "dual-horiz" mode. ASP-db fills the SelectBox with all the "Distinct" values for the specified field(s). When the user selects an entry in the box and clicks the "Submit" button the selected record will be displayed in "form" mode
X.dbSelectBox="7, Employee Name, Click to Select; #LastName#, #FirstName”
Note: Setting dbGridInc to -1 will create a Select Box with ALL records in it for the user to choose from.
You may optionally override the delimiters used.
See discussion below for more details.
dbStartUp
string
Allows you to present the Filter screen first, instead of displaying the grid or form and making the user click on the filter button.
Example:
X.dbStartUp = “filter”
dbStatusBar
Boolean
(Default=True)
Show/Hide StatusBar
X.dbStatusBar=False
dbSuppressMsg
Boolean
(Default=False)
Suppresses error messages when
1) No records are found for a filter
2) Bad field specified in dbFilterFlds
3) Bad field specified in dbFilterFlds (Pro version only)
dbTables
List length, Heading text, Button text
Defines the look of the list of tables. This is to be used when dbSQL = "*" is used. The first parameter is the vertical length of the list of tables. If there are more tables in the database than will fit in this height, you will get vertical scrolling. The Heading text appears at the top of the list and the Button text is the legend for the button.
Example: x.dbTables = "5,Choose a Table,Click here"
Note: Commas are not allowed within the text parameters.
dbUnit
Integer
Defines a number for this display session. It is recommended that you define a unique number for each of your pages. This helps prevent variables and settings from getting intermixed across pages.
X.dbUnit=1
Y.dbUnit=2
Note: See the Troubleshooting Section of an important tip on setting this property.
dbVersion
Latest version number
This is a “read only” property. You can use it to display the version date of ASP-db™.
Response.write(“Version Info is : “ & X.dbVersion)
OPTIONAL Properties - PRO Version Only
Properties
Values
Purpose / Example
dbEditFlds
FieldNames or FieldNumbers
Mydb.dbEditFlds = "Name,Salary"
If you don't specify this property, you will see all fields in the edit screens. Simply list the field names or numbers to have them included on the Edit/Add/Delete/Update screens.
dbEditDropFlds
FieldName,
Connection,
Table Name,
FieldName;
repeat as necessary
Mydb.dbEditDropFlds = Same syntax as dbFilterDropFlds
Used to define a list of legal values for this field which will appear in a drop-down list.
Example of user defined Edit drop field:
Mydb.dbEditDropFlds = Salary,,,5000/7500/9000/11000"
dbEditParams
String
Mydb.dbEditParams = "TableName=People BookMarkFlds=Name+Age, TableTag=Border=2, RecordScope=single, CriteriaSize=4x25, BooleanAsBit=true (default = false)"
Note: The TableName and BookMarkFlds parameters are REQUIRED. TableTag, RecordScope, and CriteriaSize are OPTIONAL.
See discussion below for more details.
dbEditUpdateROFlds
FieldNames or FieldNumbers
Mydb.dbEditUpdateROFlds can be used to define which fields are to be READ ONLY during User Updates.
Example: Mydb.dbEditUpdateROFlds = "Name,SSN,8"
dbNavigationItem
String
Mydb.dbNavigationItem = "top, bottom ... add, delete, update, edit"
In order to "turn on" the editing buttons in the Pro version, you have to add one or more of the following key words to your dbNavigationItem property:
add, delete, update, edit.
See discussion below for more details.
Additional Discussion on Selected Properties:
dbBLOB (default=none)
A BLOB is a Binary Large Object. It can be a bitmap image (i.e. MS Paintbrush object), Excel spreadsheet, Word document, etc. Using the dbBLOB parameter, you can specify which type of binary object your datasource contains, and what format it should be delivered to the browser in.
Web browsers (Netscape, Internet Explorer, etc.) understand a number of MIME (Multipurpose Internet Media Exchange) types of web files besides basic HTML files. For example, they can display image/gif, image/jpeg, zip files, audio files, video files, and much more. In order for ASP-db™ to properly read and deliver a BLOB object to the end-user’s browser it needs to know how many bytes long the header is before the actual data begins, and its MIME type. If your BLOB is a GIF or JPG image, you can actually display it right inside a grid cell. If not, then ASP-db™ will display a hyperlink, and when the user clicks on it, it will download and launch the associated application (e.g. MS Powerpoint).
Syntax:
X.dbBLOB="FieldNameOrNumber, BLOB_Context_Type, Replacement_Text, BLOB_Offset”
Where:
FieldNameOrNumber is the Database’s field (e.g. [First Name], [Employee Photo], 5).
BLOB_Context_Type is the HTML context type (image/bmp, image/gif, application/msexcel etc.) These can be found in your browser’s “Helper Apps”.
Replacement_Text is the text to display in the cell (e.g. Click to display this spreadsheet). Note, this is only used when an embedded GIF or JPG image is not used.
BLOB_Offset is the BLOB’s offset Every database implements BLOBs differently. When binary objects are stored in the data field with an attached header, you must determine how many bytes (if any) are delivered in front of the actual binary data. Some examples are:
Access OLE-OBJ field containing BMP images – Offset = 78 (NWIND Employee Table example)
Borland Paradox’s BLOB field storing images (Biolife example) – Offset = 8
Set Offset to –1 if hyperlinking is not desired. In this case, the image will be displayed “in-line”.
Examples:
Hyperlink - Using Paintbrush as the helper application that will be launched when a .BMP file is the BLOB field in a MS Access database:
X.dbBLOB="Photo, image/bmp, Employee Picture, 78"
Use replacement text only - Places “Employee Picture” link in the cell with NO hyperlink
X.dbBLOB="Photo,, Employee Picture, -1"
Embedded “inline” GIF or JPG image shown in the table. Placing the keyword “browser” in the “replacement text” parameter signals ASP-db™ that you wish to have the image displayed “inline” as in this example.
X.dbBLOB=”Photo,image/gif,”browser”,78”
Note: In order to work with BLOB data fields, your ODBC data source must support this data field type. If Microsoft’s supplied ODBC drivers are not sufficient for your needs, then vendors which specialize in ODBC drivers (such as InterSolv - www.intersolv.com) may be able to provide you with a more powerful driver that meets your needs. For example, the Borland Paradox driver doesn’t support BLOB fields, and the only binary image objects that MS Access can store are basic BMP (Paintbrush) files.
Following is an example set of code which works well displaying GIF files directly inline using a Paradox database with Intersolv’s ODBC drivers. In this configuration, the data is delivered with no header bytes whatsoever. The actual GIF file is the only data delivered by the driver:
<%
response.buffer=true
Set X=Server.CreateObject(“ASPdb.View”)
X.dbDSN=”myParadoxDSN”
X.dbMode=”dual”
X.dbBLOB=”Photo,image/gif,browser,0”
X.ASPdbView
%>
dbBoolText (default=”True,False”)
This property offers a method of replacing the “True,False” standard Boolean text displayed in a Boolean type of cell with any user defined text or HTML tags.
Syntax – X.dbBoolText = “true_replacement_text, false_replacement_text”
The following example uses a smiley face and a sad face to represent true/false.
X.dbBoolText="<IMG SRC=""images/smileface.gif"">,<IMG SRC=""images/sadface.gif"">"
dbColGraph (default=none)
dbColGraph displays any numeric field as a horizontal bar chart in both grid and form mode.
Syntax:
dbColGraph = "TableName, FieldNameNumber, Width, Height, Icon, Style, Min, Max"
Where:
TableName - is the name of the table containing the field to be displayed. It can not be the result of an SQL "JOIN" operation, but must be a table name.
FieldNameNumber - the field to be charted (either the name or number 0 - n)
Width - the size in pixels that the widest bar will be displayed.
Height - the height in pixels of the chart.
Icon - the filename of the GIF or JPG file to be displayed - see below for more details.
Style - a number from 1 to 8 which selects the style of chart.
1 - Character (e.g. "x") with no value displayed next to it.
2 - Character (e.g. "x") with value displayed next to it.
3 - Icon (e.g. "dollarsign.gif") with no value displayed next to it.
4 - Icon (e.g. "dollarsign.gif") with value displayed next to it.
5 - Icon Stretched (e.g. " bluebar.gif") with no value displayed next to it.
6 - Icon Stretched (e.g. " bluebar.gif") with value displayed next to it.
7 - Icon Shadowed (e.g. "bluebar.gif") with no value displayed next to it.
8 - Icon Shadowed (e.g. "bluebar.gif") with value displayed next to it.
Min, Max - These values are only necessary when the data source is a user supplied recordset (dbRecordSet property). They must be set to the minimum and maximum values that the field will contain. They are necessary for ASP-db to scale the character of icon to the proper size. With other than the dbRecordSet data sources, ASP-db automatically figures out the minimum and maximum values before displaying the first record, and then scales the bars proportionally.
Additional details:
Styles 1 and 2 simply repeat the specified "Character" (e.g. "$") in the cell a number of times proportional to the value of the field.
The Icon parameter can be any GIF or JPG file you wish to have displayed. The type of graphic you would use will depend on the style you choose. If the style is 3 or 4, then ASP-db will simply "repeat" the graphic a number of times proportional to the value of the field. An example of how this might be used, would be to use a "dollar sign" GIF file. A database with the values 1 and 3 might then have 10 and 30 of those GIF files displayed in this field. If Style 5 , 6, 7 or 8 is chosen, then the specified Icon file would be stretched to be as wide as necessary to achieve the desired width (as a percentage of the specified Width parameter). With Styles 7 and 8, the file "shadowbar.gif" is drawn below and to the right of the specified Icon to give the chart a drop shadow effect. It is suggested for styles 6 through 8 that a 1x1 GIF file be used. ASP-db will then "stretch" that GIF file (using the IMG width and height) parameters to whatever size is necessary. The sample GIF files redbar.gif, greenbar.gif, bluebar.gif, blankbar.gif and shadowbar.gif are included in your ASP-db ZIP file. It is suggested that these files be placed in an "IMAGES" subdirectory and that you set the dbImageDir property to point to this directory.
Important: If you do not specify the dbImageDir property, ASP-db will not know where to find either the ICON file specified in the "Icon" parameter, or the blankbar.gif or shadowbar.gif which are used in styles 5 through 8.
dbColor (default=”1, Auto, None, None”)
There are two ways to set this property string:
1. Use System Presets - Initial Color Number (1-15), Auto , Horizontal Strips, Vertical Strips
2. User specified colors - TableBG, HeaderFG, HeaderBG, TableDataFG
When property is set using method #2, it implies that the programmer prefers his/her own color scheme and the auto feature together with the strip feature will be automatically disabled.
This property controls color of the displayed table. If not specified, it defaults to 1 and “Auto”. Color #1 is "FFFFFF,000000,FFFFFF,000000". There are 15 built-in system color schemes. If “Auto” is used, the initial color index will be the one in the property string and the NavigationBar will have an option item that upon every click, will advance to the next color scheme. If Auto is not present, the table is set to a single color scheme. The optional horizontal or vertical “Strip” parameters display different background colors for odd and even rows/cols. Use light colors for these settings to create a better visual effect. Examples:
X.dbColor=”4,Auto”
X.dbColor=”4,Auto,LightGreen,Green”
X.dbColor="30E0E0,000000,FF8080,000030"
X.dbColor="red, green, blue, yellow"
dbCSVDelimiter (default=chr(9))
This property sets the delimiting character that is used to separate the fields of data sent to the user’s browser when they click on the “Download” button. Usually people think of this type of file as a “CSV” or Comma Separated Value file. The problem with using commas as the delimiter with MS Excel is that it will not parse the fields properly unless the extension is .CSV. If however, the delimiter is a tab character, then it will parse the fields out properly regardless of the file’s extension. Examples:
X.dbCSVDelimiter = “,”
X.dbCSVDelimiter = chr(9)
X.dbCSVDelimiter = chr(13) + chr(10) ’ For Carriage Return Line Feed
dbFilterFlds (default=none)
dbFilterHideFlds (default=none)
Normally, only a subset of key fields are used to perform filtering. This property sets the Recordset filter fields using two opposite field selection approaches – “fields to show” and “fields to hide”. The “hide” property is only effective when the dbFilterFlds property is blank. In this case, all the fields in the recordset less the hidden ones are used for the filtering process. Note that all OLE object fields (type 205) are ignored. ASP-db™ will automatically detect the field type and present the appropriate operator for the field comparison operation. For example, if the field is a text field, the default operator in the drop down box will be the “LIKE” operator. If the field is a number field, the default operator in the drop down box will be the “=” operator. Remember to use the “%” as the wild card text search character instead of the standard “*” character unless the dbEasyFilterText property is set to true in which case “*” characters will be automatically translated to “%” characters. If the pair of single quotes (‘) or (#) are not present in the text / date field, it would be provided automatically during the submit action. Note that if no record is found, the exported session variable “RecordSetCount” will be 0.
dbFilterDropFlds (default=none)
This property specifies which fields (on the Filter screen) will use “drop down” select boxes. The contents of the drop-down list is filled from all the unique values that exist in the database for that field. This option is very useful for allowing the user to search for fields that are known to exist. For example, in a Real Estate database, making the “City” field a dropdown list would only show the user the cities that exist in the database saving unnecessary typing and empty search results.
When the dbFilterDropFlds property is not blank, a “DropDown ?” button will appear in the Filter Setup screen. This button will toggle the dropdowns of the filter values. Note that the text on this button as well as the “Apply Filter” button is user customizable. (see dbFilterParams)
dbFormMemo / dbMemoTextSize (default=memo fields will not be displayed)
This property displays a memo field(s) after the “grid” and/or “form” display. Note that in some older versions of IE, the text area does not wrap text. The first optional parameter is the size of the text area and defaults to 10x50 if not entered. The rest of the string consists of FieldName/FieldNumber of memo field(s).
X.dbFormMemo="15x50,Comment1, Comment2 " (field 8 and 9, size=15x50)
X. dbFormMemo ="8" (field 8, size = 10x50)
A related property dbMemoTextSize allows some or all of a memo field to be displayed directly in the table cell area. Example:
X. dbMemoTextSize = 50 would display the first 50 characters of all memo fields in their corresponding cell area of the Grid or Form.
X. dbMemoTextSize = 0 would display the word “Memo” in their corresponding cell area of the Grid or Form.
X. dbMemoTextSize = -1 would display the entire memo in their corresponding cell area of the Grid or Form.
dbFormCol (Default=”1,auto”)
dbGridCol (Default=”1,auto”)
A column is defined as a partial display of the display unit (grid or form) adjacent to each other in the horizontal direction from left to right. For example, if a grid has 2 fields and 100 rows, it can be displayed as 5 columns of 20’s each has 2 fields when dbGridCol=”5”. When a form (single record) has 100 fields, it can be displayed as 5 columns of 20’s. Use this in conjunction with the row+/- will generate a very appealing effect!
The default (blank property) is “1, auto”. Auto means the NavigationBar items “Grid+”, “Grid-“, “form+” and “form-“ will be displayed to allow user to change the display on the fly. In case of large amounts of rows and fields, it would be desirable to set the initial column number to avoid an unwanted lengthy display.
dbGridColSort (default=True)
This property will enable/disable the use of header text as a sort agent to sort the displayed column.
dbGridInc (default=5)
This property sets the initial grid display rows. The default is 5. Also, every time the Row+ button is clicked, the number of rows displayed will increase by this amount. Without this feature, an SQL of “select * from TABLE” could potentially pull down tens of thousand of records, taking up lots of time and screen space.
dbGridIndex (default=true)
This property enables an index number to appear on the leftmost column of a grid allowing each record to be hot linked to its corresponding “form” record. There are two ways to toggle between the grid and form display. When the display mode is in “both” mode, a dynamic navigation button, “Grid” (or “Form”), is available to toggle between the two modes. When the grid is displayed, “Form” is available for the jump and when the mode is form, a “Grid” option is available for the jump. When the display is in “dual” mode, both grid and form are displayed on the screen with the grid displaying multiple records and form displaying a single record. The way to advance the “form” record is via a grid index.
dbGridTableTag (Default=none)
dbFormTableTag (Default=none)
This property provides control on the <TABLE….> display like border, padding, alignment etc. Characteristics of grid and form are different. It is not recommended to use the BGCOLOR in this property as the component has elaborate separate color controls. However, if BGCOLOR is specified, it’ll overwrite the system color control.
dbGridTHBGtag (default=none)
dbFormTHBGtag (default=none)
This property provides control on the <TH….> display like width, alignment etc. Characteristics of grid and form are different. It is not recommended to use the BGCOLOR in this property as the component has elaborate separate color controls. However, if BGCOLOR is specified, it’ll overwrite the <TH> color control.
dbMagicCell (default=none)
This is a very powerful property of ASP-db™ offering users almost unlimited control over the format and function of each cell. The idea is to allow constructing of custom cell contents using standard HTML tags in conjunction with the field variables and the macro variable #me#.
#me# will be expanded to the full name of the current .ASP file (i.e. http://www.mysite.com/myfile.asp)
#field# will be expanded to the content of any desired field(s). As always, ‘field’ can be either the field number or the field name (e.g. #1#, or #[First Name]#).
The combination of these variables with HTML tags can create amazing effects.
Note: If you need to use the semicolon or comma characters in your strings, you can define your own delimiters and change the default delimiters to other characters of your choosing. This used to be done using dbMagicDelimiter, but should now be done using an optional parameter in dbMagicCell itself.
Syntax is:
X.dbMagicCell = ”UDDField to apply, Cell_TD_tag, Cell_contents_tag, index, indexanchor ; repeat as necessary…”
Where:
UDD is the optional User Defined Delimiters. If present, the five delimiters should be surrounded by parenthesis (). See Delimiter Definitions below.
Field to apply is the field number (or name) that you wish to apply this formatting to (e.g. [First Name]).
Cell_TD_tag is the HTML tag string that will go into the TD tag (i.e.. <TD Cell_TD_tag>. Some examples of the Cell_TD_tag are align, valign, bgcolor etc.
Cell_contents_tag is used to specify what you wish to appear “inside” each cell for that field. Some examples of the Cell_contents_tag are <A HREF…, <IMG SRC…, http://url/action?data;:more data, etc. The following examples illustrate a few of the things that you can do with this powerful property. You can see a “live” example of what this can do by visiting our web page and stepping through the demonstration pages. The difference between “demo4.asp” and “demo4x.asp” is primarily through the use of this tag, and the dbNameMap tag.
index (optional) Specify this keyword if you want this column to be the index into for the drill-down. If you use this, you should set dbGridIndex=false.
indexanchor (optional) Specify this keyword if you want to go to an anchor when drilling down into the form. This helps ensure that the resulting form will be visible on the page.
Additional dbMagicCell information:
A special feature of dbMagicCell allows you to URLEncode a parameter that you want to pass on the URL line. This is necessary because spaces are not allowed with a URL parameter. Just put parenthesis around the field number that you want to have URLEncoded. For example:
MyDb.dbMagicCell = "0,,<A HREF= part2.asp?Name=#(0)#>#0#<A>"
would create a HREF to “part2.asp?Name=Bob+Smith” when the user clicks on the name “Bob Smith” in the first (0th) column.
Note: Multiple entries (fields) are separated by a semi-colon (;) while the three parameters are separated by commas (,). Therefore, semi-colon and comma cannot be used in the macro string.
dbMagicCell Examples:
X.dbMagicCell=”[First Name],align=center,#[First Name]# #[Last Name]#
This basic example will display both the First Name and Last Name fields in the cell where normally only the First Name would be shown. It will center align it in the cell. In this type of formatting, it is often desirable to hide the Last Name field since it was shown in the First Name cell. This can be easily accomplished by using the dbFormHideFlds or dbGridHideFlds commands.
X.dbMagicCell="PictureField,align=right BGCOLOR=yellow,<A HREF=""cardb/#picture#"">#[Car Name]#</A>; 1,,<A HREF=""#me#?But=gridNext::0"">#1#</A>"
This example sets the properties for two different fields. The first one (PictureField) is assumed to contain the actual filename of a picture (i.e. mustang.gif, or jjones.jpg). In this case, it would be aligned to the right in the cell, its cell background color would be set to yellow, and in the cell contents, it would contain the name of the car (taken from the “[Car Name]” field) for the current record (e.g. “Ford Mustang”). The displayed Car Name would be a hyperlink, and clicking on it would display the actual photo (e.g. mustang.gif). Note the use of the double quotes. Whenever you wish to embed a quote (“) character in a parameter, simply enter two quotes in a row (“”).
The second field in this example is field #1 (the second field - remember, they start at 0). In the cell contents, it would display the contents of the field as a hyperlink. Clicking on that link would redisplay the current file, and scroll to the first “page” of records.
There is a special provision in the #filenameNumber# macro such that if the last character is a period, then only the text left to the period will be returned (filename). Example:
X.dbMagicCell="filename,,<A HREF=""#filename#""><IMG SRC=""#filename.#.gif""></A>"
This comes in handy when displaying a gif thumbnail of a jpg file.
A dbMagicCell Case Study - Passing data from Parent to Child
The following case study illustrates the power of this property.
Database: NorthWind
Tables: [Orders] and [Order Details] - both “linked together” and displayed on the same web page.
Common Key: [OrderID]
Objective: Implement a “parent/child” database setup such that when the [OrderID] field is “clicked” in the [Orders] table, the [Order Details] table will show the corresponding records for the particular [OrderID].
What is the minimum number of lines of code would it take to do the job? 13! Adding some “cosmetic” code brings the total to 33.
Here are the 13 “essential” lines of code and a description of their function.
Line #
Description
01
Create the object for the primary Database containing the [Orders] table
02
Select the NWIND Database from a DSN
03
Select all records and use the dual-horiz mode to have a better view
04
Define as unit #1 of the multiple Database
05
The work horse
Hyperlink field #0 [OrderID] using an action to activate “myself” and pass a variable called “ID” (could be any valid name) containing the content of field #0. Content of #0 is also displayed in the Cell as “Click for details for ….” Where “….” Will be substituted with the actual field value.
06
Display database #1
07
Use a variable called myvar to receive the passed variable during reentrance.
08
Test for condition of myvar such that Database #2 will not be displayed during the first entry.
09
Create the object for the secondary Database containing the [Order Details] table
10
Select the NWIND Database from a DSN
11
Display database #2
12
Select and display the appropriate records according to Database #1 sorted by [ProductID]
13
Display database #2
Following is the complete program including the extra “cosmetic” code. The lines that correspond to the above 13 steps are indicated with “**” comments on the right.<CENTER><h2>Database #1</h2></CENTER>
<%
Set X=Server.CreateObject("AspDB.View") ‘** 01
X.dbDSN="NWIND" ‘** 02
X.dbSQL="Select * FROM [orders]" ‘** 03
X.dbmode="dual-horiz"
X.dbUnit=1 ‘** 04
X.dbcolor="7,auto,lightgrey"
X.dbGridColSort=true
X.dbGridDisplayFlds="0,1,2"
X.dbGridtabletag="border=1"
X.dbFormtabletag="border=1"
X.dbGridInc=13
X.dbMagicCell="0,,<A HREF=""#me#?ID=#0#"">Click for details of #0#</a>" ‘** 05
X.aspdbView ‘** 06
%>
<%
myvar=request("ID") ‘** 07
if myvar<>"" then ‘** 08
%>
<CENTER><h2>Database #2 - Order Details for #<%=myvar%></h2></CENTER>
<%
Set Y=Server.CreateObject("AspDB.View") ‘** 09
Y.dbDSN="NWIND" ‘** 10
Y.dbmode="grid"
Y.dbUnit=2 ‘** 11
Y.dbcolor="4,auto"
Y.dbGridTableTag="BORDER=1"
Y.dbNavigation="none"
Y.dbSQL="Select * FROM [order details] where orderID=" & myvar & " order by ProductID" ‘** 12
Y.aspdbView ‘** 13
end if
%>
dbMdb
dbDat
dbDSN
dbRecordSet
The purpose of these properties is to tell the ASP-db™ component where your data source resides. One (and only one) of the above properties must be specified. Each property requires that a parameter be specified (there are no default values for these properties).
The "dbMdb" and “dbDat are special “shorthand” properties for MS Access and MS-SQL only. When the location of the .mdb or .dat file is specified, it will be translated into the following code:
"driver={Microsoft Access Driver (*.mdb)}; dbq=" + yourfile.mdb
or
"driver={SQL Server};Server=" & server & ";database=" & database & ";UID=" & uid & ";PWD=" & pwd
A convenient ASP function (MapPath) exists which will “map” a URL path into a physical path. This is very useful when your .MDB file may reside in different locations on different servers, or when its location may move. By using the Server.MapPath function, the server will translate the URL into a physical path. For example, if you have a file, Myfile.mdb in the same directory as your .ASP file which refers to it, you can simply specify: dbMdb=Server.MapPath(“Myfile.mdb”) and the server will translate that into “D:\xxx\xxx\Myfile.mdb” or wherever your actual file resides.
dbDSN specifies the database location using a system (Data Source Name). Either a File DSN or System DSN can be used, but we recommend you create a System DSN. To do this, you would go to the Control Panel, and double click on the ODBC icon. Next you would choose the System DSN tab and Create a new DSN (“nwind” for example). Finally, you would select the database that this DSN points to (e.g. D:\myfiles\nwind.mdb). From then on, any ASP application on this server can use this DSN to access the chosen data source.
The dbDSN property is translated into the following code:
dsn1 = yourDSN (i.e. "nwind")
oRs.Open mySQL, dsn1, , , adCmdText
dbDSN = "DSN=dsn1; UID=x; PWD=x;"
Note: Do not use any table or query that contains elements local to Access and not supported by ODBC like parameters, links etc.
DbRecordSet is a property which enables a user to process their own recordset in advance and then pass the recordset object to ASPdb for display. The recordset object will be preserved upon exit to ASPdb. Filter and Column sorting will be disabled. The assumption is that these sorting functions will be carried out upstream during the construction of the recordset object. There are two conditions in which this property can be used:
1. Cursor type must not be forward only (it must be > 0)
2. RS.RecordCount must be > 0
Example of how to read an Excel spreadsheet:
Create a file called file-xls.dsn (or something similar) as shown below:
[ODBC]
DRIVER=Microsoft Excel Driver (*.xls)
ReadOnly=0
UserCommitSync=Yes
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBuffer Size=512
ImplicitCommitSync=Yes
FIL=excel 5.0
DriverId=790
Then, define your data source as follows:
myDb.dbDSN ="FileDSN=" & Server.MapPath("file-xls.dsn") & ";DBQ=" & Server.MapPath("mysheet.xls")
dbNameMap (default=none)
Often the actual field names contain unconventional characters like “_”, “(“ which are legal as a filename but non-presentable as column headers. This property allows the user to map these names to an alias. The property string contains all the names to be mapped separated by semi-colons. Each map consists of 3 parts separated by commas: FieldName/Number, Display Name, and column attributes. Column attributes contain all the legal tags like width, alignment etc. with one exception. Due to the fact that this property applies to both “form” and “grid”, the COLSPAN and ROWSPAN, if used, must be specified simply as SPAN. The ROW/COL attribute will be determined upon displaying “grid” or “form”. Another exception is that when “form” column is greater than 1 the SPAN effect will be disabled.
X.dbNameMap="0,Name and Manuf,SPAN=2 WIDTH=50%; 1,MPG,"
X.dbNameMap="year,Yr,; 5,MPG,"
Notes:
· There must be exactly (2) commas in each map set.
· If SPAN=n is in use, column sort will be on the first spanned field only.
· If you need to use the semicolon or comma characters in your strings, you can use the dbMagicDelimiter to change the default delimiters to other characters.
dbNavigation (default = “bottom”)
dbNavigationItem (default = all)
dbNavigationIcon (default = none)
There are three navigation controls - dbNavigation, dbNavigationItem, and dbNavigationIcon.
dbNavigation is used to control the show and hide property of the entire Navigation bar. Choices are none, top, bottom, or both. Normally when Navigation is off (none), the user programs all the navigation functions. For example, the user might want to use a set of customized images of buttons instead of the standard text items.
When dbNavigation is “top”, “bottom” or “both”, the user has another option to control which items are to be displayed. The dbNavigationItem property lets you choose which buttons appear next to the table. The possible "buttons" are: top, prev, next, bottom, gridrow, gridcol, formcol, filter, download, color, and reload. These items are not case or order sensitive. For example, if the user does not want to offer the download, filter, or color features, then the following should be specified:
X.dbNavigationItem="top, prev, next, bottom, gridrow, gridcol, formcol, reload"
dbNavigationIcon property allows the user to substitute the navigation bar text with his/her own bitmaps. A standard set is supplied in the package. The format of this property string is:
Path and file extension, grid, form, top, prev, next, bottom, row+, row-, grid+, grid-, form+, form-, filter, resetfilter, download, color, reload
Path is the location of the directory containing the images. File extension is the common file extension of the images. Use this field unless the images are not the same type (mix of gif and jpeg) which is uncommon. In that case, leave this field blank and the following filenames are expected to be full name. The following 16 names must be in the right order. The files underlined must have a “grayed out” counterpart image. This image is used when the item is not “hot” or “linked”. For example, if the name of the “bottom” button image file is “bottom.gif” then there should be a “g_bottom.gif”.
Examples: X.dbNavigationItem = “gif, grid1, form1, mytop, …”
X.dbNavigationItem = “images, grid1.gif, form1.jpg, mytop.jpg, …”
X.dbNavigationItem = “std” (see note below)
Notes:
· The Maximum length of any property string is 256 characters.
· The default NavigationItem is - "top,bottom,pre,next,gridrow,reload" for grid related modes and the same without "gridrow" for "form" only related modes.
· The default NavigationItem overrides all other properties like dbGridCol, dbFormCol, dbColor etc. That means if button is not shown, then functions are not available.
· The dbNavigation="top/bottom/both/none". Only one Statusbar (if true) will “stick” to the bar as appropriate.
· The "grid/form" buttons are controlled by the "dbMode" and "dbGridIndex" properties and not controlled independently.
· A shortcut feature avoids long lines in your ASP file when specifying the dbNavigationIcon and choosing to use the default names suggested by MMS. Specifying X.dbNavigationIcon = "std" is equivalent to entering X.dbNavigationIcon = "gif, grid, form, top, prev, next, bottom, rowplus, rowminus, gridplus, gridminus, formplus, formminus, filter, resetfilter, download, color, reload"
· Even though the dbNavigationItems properties control the display of different navigation icons/items, the system will often "over-ride" which items are shown. For example, system will not display Grid related items in a “form” mode and vice versa.
Pro Version Only:
Mydb.dbNavigationItem = "top, bottom ... add, delete, update, edit". In order to "turn on" the editing buttons in the Pro version, you have to add one or more of the following key words to your dbNavigationItem property: add, delete, update, edit. They have the following functionality:
Add (Pro Version Only) - This button allows users to ADD records to the table specified in dbEditParams / TableName. Your "key" field(s) should ideally be an AutoNumber field. In this case, you would hide this field from your data entry screen, and when the user adds a new record, it would automatically get the next available value for the autonumbered ID field.
Delete (Pro Version Only) - This button deletes the "selected" or "current" record. Before doing the delete, ASP-dbPro will display the record (in Form mode), and you will then have to press the "Delete Current Record" button to complete the action. Note: See the comment below on selecting the "current record".
Update (Pro Version Only) - This button will bring up the "current" record in form mode and allow you to edit any of the displayed fields. It is legal to update even the "BookMarkFlds", but be careful not to create duplicate keys! Note: See the comment below on selecting the "current record".
Edit (Pro Version Only) - This button allows the user to do all three of the above functions, plus adds a new feature - cloning using a button labeled "Copy". If you enable the Edit button, you usually wouldn't even show the Add, Delete, or Update buttons. To use the "Copy" feature, simply click the "Copy" button and ASP-db will duplicate the current record (by copying it from the left side of the form to the right side). You can then edit the "New Record" (right side) and modify any fields that you wish. Note: See the comment below on selecting the "current record".
Important Notes (Pro Version Only):
a) If you fail to hide an AutoNumber field from the edit screen (with the dbEditFlds property), then updates will not take place since it is illegal to specify a value for an AutoNumber field. The RECOMMENDED procedure is to create an AutoNumber field, and set BookmarkFlds to this field, and to hide it from editing using the dbEditFlds property.
b) The Delete, Update and Edit actions work on the concept of a "current" record. In the "grid" mode, there is no way to "select" a record, so it doesn't make sense to be in this mode when performing editing functions. The "dual, dual-horiz, form, and both" modes of operation all have a way of choosing a specific record. One of these modes should be used with the editing functions. In order to choose an active record in dual or both mode, you simply need to click on in "#" column in order to make it the active record. Then, when you click on Delete, Update, or Edit, it will use that selected record as the "current" record. In "form" mode, the current record is simply the record you a viewing.
dbEditParams (Pro Version Only):
Mydb.dbEditParams = "TableName=People BookMarkFlds=Name+Age, TableTag=Border=2, RecordScope=single, CriteriaSize=4x25"
The parameters are as follows:
TableName - Specify the name of the table in the current data source that you wish to edit.
BookMarkFlds - Specify the fields which are necessary to make up a unique key for the current record. It can be a single field name or number (such as "ID"), or can be a combination of fields such as "LastName+FirstName". It can even be the sum of all of the fields in the record such as:
BookMarkFlds=0+1+2+3+4+5.
TableTag - This is the HTML code that you wish to have included inside the <TABLE> tag for the table that is used on the edit form. For example, TableTag=BORDER=2 would surround the entire edit form with a border of 2.
RecordScope - This parameter determines the scope of how many records will be affected by the current update or delete request. Choices are: Single, Multiple, All.
Single - This is the default value and specifies that changes are to affect only a single record in the specified table. If ASP-db detects that more than one (or zero) records are affected by the update, then it "Rolls-back" the transaction and displays an error message.
Multiple - This mode allows a change to affect more than one record in the data source. It will cause an editing window to automatically appear below the editing form. In that window, the user may type any SQL "WHERE" condition that selects which records they wish to affect with the current change. For example, if you wish to change all of the records where COMPANY=Jones to COMPANY=Jones, Inc., you would specify RecordScope=Multiple, and dbEditFlds="COMPANY". Note: This feature is not yet operational!
All - This mode allows a change to affect all of the records in the data source. For example, if you wish to change all of the records to COMPANY=Jones, Inc., you would specify RecordScope=All, and dbEditFlds="COMPANY".
Note: This feature is not yet operational!
CriteriaSize - This is the dimensions of the editing window (rows x columns) that is displayed when RecordScope=multiple or RecordScope=All.
BooleanAsBit=true (default = false) - Set this when using SQL or any Database system that uses type 11 as bit instead of boolean. Then 1/0 will be used (1=true, 0=false) for SQL. Note that ADO filter works with true/false. Bits(1/0) is not the same as true(-1)/false(0).
dbOptions
Parameters include:
ConnectTimeout =100 (default = 300 seconds).
GridInitSortDESC=True (default = false)
DateWrap=' (default = #)
FontSize=5
CloseConnection=true (default=false)
Heading=Your heading at the top of the #tablename# table. This parameter defines the heading to used above your database display, with #tablename# being replaced by ASP-db with the name of the table being viewed when used with dbSQL = “*”. This text will appear at the top of your grid or form. If a filter is applied and no records are found, this heading will not appear.
MemoDownload=true (default=false)
Examples:
MyDb.dbOptions = "ConnectTimeout=300, DateWrap=#, FontSize=7 "
MyDb.dbOptions = "(;|/)Fontsize=4 | Heading=<B>Hello, now viewing the #tablename# table.</B><BR>"
In the above example (;|/) is an optional parameter that allows you to specify your own delimiters. That may be necessary if your heading contains commas.
CellFontTag= and HeaderFontTag= to control the header and cell font atributes. Do not use these keywords to control the color attribute.
Example: dbOptions = "( ; | ) CellFontTag=SIZE=2 | HeaderFontTag=Face=""Courier, Lucida Sans"" Size=4"
Note that if Face is used and it involves multiple fonts separated by commas, you have to use user delimiters.
dbSelectBox
This property is used to add a select box to your display. Actually what it is doing is replacing the standard “Grid” display with a scrollable list. The Grid navigation buttons can be used with the Select Box, since it is basically just a different style of a standard grid,. It makes the most sense when the dbMode is set to “dual” or “dual-horiz”. ASP-db fills the SelectBox with all the distinct values for the specified field(s). “Dual” puts the Select Box above the Form and “Dual-Horiz” puts the Select Box to the left of the form.
For example: X.dbSelectBox = “7, Employee Name, Click to Select; #LastName#, #FirstName”
This would create a Select Box (a scrollable list of items) with room for 7 items to be seen. The Select Box will automatically have a vertical scroll bar, if required. The list will include every Employee Name in the database, with each item on the list consisting of the Employee’s Last Name followed by the Employee’s First Name all on one line. Be careful. The list of items in the select box will only include those records which would have been seen if the select box were a grid. If dbGridInc is set to 10, you will only see the Employees from the 10 records currently presented. However, if you want to see ALL possible employees, set dbGridInc to -1. Just be aware that if your database contains 10,000 employees, you’ll have one very long list! The title at the top of the Select box will say “Employee Name” and the legend on the submit button will say “Click to Select”. When the user selects an entry in the box and clicks the submit button, the selected record will be displayed in "form" mode.
Note that there is a semi-colon after the first three parameters. The fourth parameter may contain embedded commas which will then be displayed in the list of items. In the example above, the list items will contain:
The Last Name followed by a comma followed by a space followed by the First Name. You could also embed words in the fourth parameter. For example, if your database included fields called Name and City, your fourth parameter could be:
#Name#, from the city of #City#
and
“Mark, from the city of Southfield”
would be seen on the list.
dbSQL (mandatory, no default)
This is the backbone property in defining which records from the database are to be viewed. If you want to use the built-in auto sort feature, do not use the ORDER BY clause. "Memo" and "BLOB" might not be displayed in either “grid” or “form”. The word “MEMO/BLOB/OLE-OBJ” will be displayed. However, MEMO fields can be displayed by using the Memo property.
Note: Be careful to use the correct syntax when using ACCESS, MS-SQL and other ODBC based data provider.
There is a special form of dbSQL. You can use dbSQL = "*" to allow you to browse through all of the tables in the database. When you use this "wildcard" form of dbSQL, you will be presented with a list of tablenames. Other useful features when wildcard is used: dbTables, dbHeading.
You may optionally provide the SQL ownername to the table parameter. Such as “Select * from sally.phonenumbers”. The general form for tablename is “database.owner.tablename” and the general form for field is “tablename.fieldname”.
dbStatusBar (default=true)
This property turns the Status bar on/off. The Status bar includes all status messages like the record pointer, sort field, filtering messages, and color. Even with the status display turned off, all pertinent information will be exported as session variables so that the programmer can retrieve these variables for complete control. (See Section IV d.)
dbUnit
When using multiple databases, this number property is mandatory in identifying the individual databases. For instance, if you open the same database twice and prefer each has its own controls, it is considered to be a multiple database and each must have its own unit number. This value is suffixed to all the export variables. For example, the exported recordset variable for DB1 and DB2 would be session(“RS1”) and session(“RS2”). This property should also be set whenever more than one page will contain an ASP-db component. Please read the Troubleshooting section regarding Returning to a Bookmarked Page for more information.
dbVersion
This gets the version number of the ASP-db™ component and is the only published property. User should make a note of this number before contacting tech support.
Sorting field Columns (Ascending and Descending)
When the user supplied SQL does not include the “ORDER BY” clause, the field names in the header will be hot linked (except memo and OLE OBJ). This particular hot link means that when clicked the first time, the column will be sorted in ascending order. When clicked the second time consecutively, the sort order will be changed to descending. Clicking another field will repeat the procedure starting at ascending order.
Delimiter Definitions (User Defined Delimiters)
You may redefine or override the standard parameter delimiters used within the various ASP-db properties. This is accomplished within the property statement itself by specifying the delimiters that you want to use right at the beginning. Just put the delimiters inside parenthesis and then you may use those delimiters in the rest of the statement. The general form is:
X.dbProperty = “(abc)parm1,parm2,parm3 ; parm1,parm2,parm3 ; parm1,parm2,item1/item2/item3”
If (abc) is present, then a is the major delimiter, in this case a semi-colon, b is the minor delimiter, in this case a comma, and c is the micro delimiter, in this case a slash. For example, say parm1 was a company name like “Jones, Inc.”. You would need to be able to include a comma in the parameter meaning you wouldn’t be able to use a comma for a delimiter anymore. You should do this instead: X.dbProperty = “ ( ; | / ) Ford | Nike | Jones, Inc. ; Cars | Shoes | Hats ” (Note: spaces are inserted in this documentation for readablity purposes and should not be used in your code.)
dbFilterDropFlds:
The three delimiters used by this property are major separator (between the groups of four parameters), minor separator (between parameters), and micro separator (within the fourth parameter)
dbMagicCell:
The five delimiters used by this property are major separator (between the groups of three parameters), minor separator (between parameters), left format delimiter, right format delimiter, and field contents encloser. Examples:
X.dbMagicCell = “ ( ; , [ ] ^ ) Cash, align=center, <font color = red> format = [currency] </font> ”
X.dbMagicCell = “ ( ; , [ ] ^ ) Photo,,<IMG SRC = ^Photo^> ”
dbSelectBox:
The three delimiters used by this property are major separator (follows the first group of three parameters), minor separator (between parameters), and field contents encloser. Example:
X.dbSelectBox = “ ( ; , # ) 8,Pick a Product,Click to See Inventory; #ProductID# --> #ProductName# ”
d. Exported Session Variables
All session variables are suffixed with the dbUnit. By default, the dbUnit is null. In this case, accessing any of the Session variables would be done as follows, Set MyRS = Session("SV_variablename")In the case of having multiple databases on a single web page, the databases are differentiated with the dbUnit. On our web site, we have an example of a web page with two database tables on it. We used "1" and "2" for our two dbUnits. For example, if DbUnit=1, then the exported variable would be exported as Session(“SV_variablename_1”). To access the variable, you would use code such as: Myvar = Session("SV_variablename_1").
Session Variable
Type
Description
SV_RecordCount
Long
RecordSet recordcount.
SV_FieldCount
Integer
Actual Recordset Field count.
SV_SQL
String
Active SQL string. WARNING! You may look at this string but do NOT modify it or even use it! Unpredictable things may happen.
SV_SelectBoxItem
String
The chosen item from the SelectBox line.
SV_Filter
String
Filter String
SV_GridStart
Long
Record index number of the top grid row.
SV_GridInc
Integer
The number of rows to display
SV_ColorIndex
Integer
Current color index (1-15)
SV_FormPtr
Long
Record index number of form record. This number is either the same as the GridStart or a selected record in “dual” mode.
SV_RecordPointer
Long
This is the value to “move” to.
Example Code: -
<%Set X=Server.CreateObject("AspDB.View")X.property=value..X.aspDBViewresponse.write("SV_RecordCount = " & session("SV_RecordCount") & "<BR>")response.write("SV_FieldCount = " & session("SV_FieldCount") & "<BR>")
response.write("SV_SQL = " & session("SV_SQL") & "<BR>")
response.write("SV_Filter = " & session("SV_Filter") & "<BR>")
response.write("SV_GridStart = " & session("SV_GridStart") & "<BR>")
response.write("SV_GridInc = " & session("SV_GridInc") & "<BR>")
response.write("SV_FormPtr = " & session("SV_FormPtr") & "<BR>")
response.write("SV_ColorIndex = " & session("SV_ColorIndex") & "<BR>")
..
Set Y=Server.CreateObject("AspDB.View")
Y.dbUnit=2
..
Y.aspDBView
response.write("SV_RecordCount = " & session("SV_RecordCount_2") & "<BR>")
response.write("SV_FieldCount = " & session("SV_FieldCount_2") & "<BR>")
response.write("SV_SQL = " & session("SV_SQL_2") & "<BR>")
response.write("SV_Filter = " & session("SV_Filter_2") & "<BR>")
response.write("SV_GridStart = " & session("SV_GridStart_2") & "<BR>")
response.write("SV_GridInc = " & session("SV_GridInc_2") & "<BR>")
response.write("SV_FormPtr = " & session("SV_FormPtr_2") & "<BR>")
response.write("SV_ColorIndex = " & session("SV_ColorIndex_2") & "<BR>")
%>
e. Troubleshooting Tips
Installation - There are three places where problems can occur when installing and calling ASP-db. They are:
(1) Registering ASP-db™. If you have followed the instructions in the Installation Section and are unable to register ASP-db, it is probably due to one of the following reasons:
a) If you are using Windows 95 and Personal Web Server, you may be using an older version. You must use PWS 4.0 or ASP-db™ will fail to register. In order to upgrade to PWS 4.0 from PWS 3.0, you will need to install Internet Explorer 4.01, and then PWS 4.0 (also called NT Option Pack 4.0). Both programs are available for free from Microsoft’s web site:
http://www.microsoft.com/ie/pws/
Finally, here's a URL that shows all the system updates that can be applied to Windows 95. The Personal Web Server is right near the top.
http://www.microsoft.com/windows95/info/system-updates.htm
b) If you are using Windows NT (server or workstation) and are using IIS 3, then you probably need to install the ADO 1.5 upgrade. This upgrades the database components to a version that matches ASP-db. The upgrade can be downloaded for free from Microsoft’s web site, and is approximately 6mb in size.
c) You are missing a dll that is required by ASP-db. A full, clean install of PWS 4.0 or IIS 4.0 will include all dll’s necessary to install ASP-db. However, if you are using an older version of their web servers, or have installed other software after your web server installation, and that other software has overwritten a dll with an older version, this could be your problem. Included with your ZIP file is the MSVBVM50.DLL file. Try putting that file in your path and seeing if it will then register. You can also verify that you have VBA5.DLL installed and registered on your system.
d) You may need to reboot your system. On some systems, after installing and registering DLLs, a reboot has been necessary in order for them to register properly.
e) You may be running an older version of ASP-db. We have made certain compatibility improvements that allow ASP-db™ to function on more diverse environments.
f) Try adding the component into the Microsoft Transaction Server rather than using REGSVR32 (or vice versa). Sometimes, a component will install with one method and not with the other.
(2) Creating the ASP-db™ Object - Once you successfully register ASP-db, the next major hurdle is creating the object. This is done with a command such as: Set MyDb = Server.CreateObject(“ASPdb.View”) If this fails, it may be due to one of the following reasons:
a) The component never got registered properly. If you see “invalid class string”, then this is usually the case.
b) You spelled the name of the component wrong (don’t forget the “dot”s in there. J)
c) You may have multiple (and possibly older) copies of ASP-db™ (or other critical files) registered on your system. If you wish to verify this, run REGEDIT, press CTRL-F (find) and type ASPDB. You should only find one class registered under that name. If you find more than one, then you may wish to remove them all, and try re-registering it again. Note: Always make a backup of your registry before making changes to it. Improper use of Regedit can cause your system to become completely non-functional! Use with caution!
d) There is a security permission problem. Try setting the “IUSR_your-web-svr-name” user id to temporarily have Administrator permission. If this solves the problem, then that’s your problem. Give this account read, write, and execute permission on the directories where your ASP files are located.
(3) Invoking ASPdbView to actually display the data - If you can register ASP-db™, and create the server object, but get an error when invoking the ASPdbView method, then this may be due to:
a) You spelled the name of the Object (i.e. MyDb) or Method (i.e. ASPdbView) wrong.
b) The dll never registered properly, or you have duplicate dlls registered. See #2c above.
c) Try commenting out your ASPdbView statement and display the dbVersion property instead. The command: response.write(Mydb.dbVersion) would do so if your object was named MyDb.
d) Your data source is either missing, spelled wrong, in a different location than you thought, or the component doesn’t have permission to open it. Try using the dbMDB property instead if you used dbDSN, or vice versa. Review the items above in steps 1 and 2 to see if any of them solve your problem. It’s possible you have the older DAO drivers and were able to register the component, and create the object, but when it went to open the data source, it failed.
(4) Microsoft InterDev keeps intercepting attempts to run the asp file, preventing ASP-db from working. Solution: Open up My Computer, then click, View, then Folder Options. Choose the tab "File Types" and look for the one that handles "ASP File". When you find it, highlight it and click the Edit button to bring it up. Then, choose Open from the actions list and click the Edit button. This will probably contain the ".exe" of Visual Interdev. Change this to the Internet Explorer ".exe". (IExplore.exe)
Finally, check our web site. We’ll be posting additional tips from time to time.
Session Timeouts - When an ASP script session times out (due to the user not responding for a given period of time - usually 20 minutes), the Session ID will change, and all the previous dynamic session variables will be lost. Since ASP-db™ keeps most of its state information in session variables, it can no longer know which options the user has chosen (color, record number, filter, gridplus etc.). Therefore, ASP-db™ will restore all the original ASP-db™ parameters as specified in the ASP script file.
dbUnit - Returning to a bookmarked page doesn't work properly - Often times users will bookmark (Add to Favorites in Internet Explorer) a page with ASP-db content on it. If any of the buttons (such as Next or Color) were pressed when the page was bookmarked, then returning to it after viewing a different page with ASP-db content on it can cause problems. Here is an example of how to re-create this problem, and how to solve it. First, create two pages with ASP-db components on them (we'll call them page1 and page2). Next, go to page1 and click the next button. Now create a bookmark for this page. Then, go to page two and click on the Color button. Finally, jump to the "bookmarked" page1. It will display with the colors chosen from page2! This is because the session variables that ASP-db uses are "over-written" when page2 loads in. Then, when you return to page1, it uses those "page2" variables therefore setting the color (and most other settings) to however you have them set in page2. This can even cause page1 to show the wrong number of records. Fortunately, there is a simple solution to this problem. Follow this simple rule:
Whenever you are using ASP-db on more than one ASP page, always set the dbUnit property to a unique value for each page.
Following this rule will save you a great deal of troubleshooting later on when users call in and report that they jump back to a page and it displays the wrong data or "looks different". In the example given above, by simply setting dbUnit = 1 in page1 and dbUnit = 2 in page2 the problem will be solved.
Clicking on a column title twice doesn't sort - If you're using Internet Explorer 3.x, then you may experience a problem where you click on a column title (for sorting purposes) and it will works fine the first time, but the second time, it will just sit there and not to do (or send) anything. This problem does not occur in IE4 or Netscape. It's due to the way the browser "updates" it's contents. Since it sees the same URL as the previous "click" it assumes it will not get new data and never even sends it to the server - therefore, nothing happens.
The solution is to change the option "Check for newer versions of stored pages" to "Every Visit to the Page". Specifically:
Click on VIEW, OPTIONS, ADVANCED (tab), and under Temporary Internet Files, click the SETTINGS button. Then check the radio button "Every Visit to the Page". That should do it!
|