<html>
<link rel=STYLESHEET href="AxpStyle.css">
<body>
<%
Dim objAxpDB
Set objAxpDB = Server.CreateObject("AxpDB.DBView")
objAxpDB.ConnectionString = "DSN=MYDSN;UID=;pwd="
objAxpDB.sql="SELECT * FROM CUSTOMER"
objAxpDB.WriteHtmlTable
Set objAxpDB = Nothing
%>
</body>
</html>
Usage:
objAxpDB.ConnectionString = "Provider=MSDAORA; Data Source=datasourcename; User ID=userid; Password=password" ' Oracle
objAxpDB.ConnectionString = "DSN=MYDSN;UID=Adm;pwd="' System Data Source Name
objAxpDB.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\db\mybase.mdb" ' Access
etc.
Usage:
objAxpDB.sql = "SELECT NAME,EMAIL FROM USERS"
Notes:
Avoid using ORDER BY clause in the SQL as AxpDB has user interface enabling
the user to sort column of choice.
See also the properties FormSQL, EditSQL and Stored procedures below.
<%
Const adChar = 129
Const adParamInput = &H0001
Dim objAxpDb
Set objAxpDb = Server.CreateObject("AxpDB.DBView")
objAxpDB.ConnectionString = "Your connection string"
' Ex.1 Parameterless Stored Procedure on MS SQL Server 2000, Northwind database
' objAxpDb.SQL = "[Ten Most Expensive Products]"
' Ex.2 Stored Procedure with parameters on MS SQL Server 2000, Northwind database
objAxpDb.SQL = "CustOrderHist"
Dim Param
Set Param = objAxpDb.StoredProcCommand.CreateParameter("CustomerID", adChar, adParamInput, 5, "ALFKI")
objAxpDb.StoredProcCommand.Parameters.Append Param
objAxpDb.WriteHtmlTable
Set objAxpDb = Nothing
%>
Usage:
objAxpDB.GridDisplayFieldNames = "User,EMail"
Usage:
objAxpDB.FormDisplayFieldNames = "User,EMail"
Usage:
objAxpDB.GridColsNoSort = "2,3"
or
objAxpDB.GridColsNoSort = "*"
Usage:
objAxpDB.GridFieldsShow= "1,2,3,5"
Usage:
objAxpDB.FormFieldsShow = "2,3"
Usage:
objAxpDB.GridFieldsHide= "4"
Usage:
objAxpDB.FormFieldsHide = "2,3"
Usage:
objAxpDB.GridFieldsSupressDup= "2"
Usage examples:
objAxpDB.Width= "400px"
objAxpDB.Width= "400"
objAxpDB.Width= "50%"
If the Html attribute "width" is set in the property TableTag or GridTableTag, the value is
extracted and automatically transferred to the Width property.
Usage:
objAxpDB.GridCellWidths= "140,500"
Usage:
objAxpDB.FormCellWidths= "140,500"
See the enclosed AxpStyle.css file for a list of all AxpDB styles in use.
Usage:
objAxpDB.TableTag= "cellspacing=2"
objAxpDB.GridColAttributes(0) = "style=""text-align:right;padding-right:4px;background-color:#d4d0c8;border-top:#ffffff 1px solid;border-left: #ffffff 1px solid;"""
...
<style>
.HighlightRow {background-color: yellow; cursor: pointer;}
</style>
...
objAxpDb.GridFreeFormatCellByCol(2) = "<a class=""AXDBTable"" href=""#AXPDBFORMURL#"">#CompanyName#</a>"
objAxpDb.GridTREvenTag = "onClick=""window.location='##AXPDBFORMURL##'"" onMouseOver=""this.className='HighlightRow'"" onMouseOut=""this.className ='AXDBTableTReven'"""
objAxpDb.GridTROddTag = "onClick=""window.location='##AXPDBFORMURL##'"" onMouseOver=""this.className='HighlightRow'"" onMouseOut=""this.className ='AXDBTableTRodd'"""
objAxpDb.EditNewPKStatement = "SELECT SEQ_TEST.NextVal FROM DUAL"
objAxpDb.SQL = "SELECT * FROM PRODUCTS"
objAxpDb.AddEditLookup "SupplierId", "Suppliers", "SupplierId", "CompanyName", "2", False
objAxpDb.AddEditLookup "CategoryId", "Categories", "CategoryId", "CategoryName", "2", False
objAxpDb.EditFieldsReadOnly = "ProductId"
objAxpDb.EditPrimaryKeys = "ProductId"
objAxpDb.DeleteSql = "DELETE FROM PRODUCTS"
objAxpDb.EditOptions = "all"
objAxpDb.RequiredFieldIndicator = "" ' i.e. No indicator
objAxpDb.RequiredFieldIndicator = " <font color=red>*</font> " ' i.e. A red asterisk
The most common reason is that the Internet Guest account (IUSR_MACHINE), which is by default part of the "Everyone" group, does not have Write permissions on the database file (.mdb). To fix this problem, use the Security tab in Explorer to adjust the properties for this file so that the Internet Guest account has the correct permissions.
NOTE: When using Microsoft Access databases with ADO, it is also necessary to give the Internet Guest account Write permissions on the directory containing the .mdb file. This is because Jet creates an .ldb file to handle database locking. You may also need to give read/write permission on the "Temp" folder because Jet may create temporary files in this directory.
See also MS KB article 175168
objAxpDB.GridFormatCellFunction(1) = "Mid,10,20"
objAxpDB.GridFormatCellFunction(2) = "Replace, USA, Unites States of America"
objAxpDB.GridFormatCellFunction(3) = "FormatNumber, 2, -1, -2, -1"
objAxpDB.GridFormatCellFunction(4) = "FormatCurrency, 2"
objAxpDB.GridFormatCellFunction(5) = "Round"
objAxpDB.GridFormatCellFunction(6) = "Abs"
objAxpDB.GridFormatCellFunction(7) = "FormatPercent, 0"
objAxpDB.GridFormatCellFunction(8) = "Exp"
objAxpDB.GridFormatCellFunction(9) = "Format,dddd mmm dd yyyy"
objAxpDB.GridFormatCellFunction(10) = "FormatDateTime,1"
objAxpDB.GridFormatCellFunction(11) = "DatePart,q,2,3"
objAxpDB.GridFormatCellFunction(12) = "InitCapsAll"
objAxpDB.GridFormatCellFunction(1) = "RegExpReplace, /(\S+)(\s+)(\S+)/, $2$1"
objAxpDB.GridFormatCellFunction(1) = "RegExpReplace, /(\S+)(\s+)(\S+)/g, $3$2<b>$1</b>"
objAxpDB.GridFormatCellFunction(1) = "RegExpReplace, /(\bMicrosoft|\bIBM)/mgi,<span style=""background-color:yellow"">$1</span>"
Usage:
objAxpDB.GridFreeFormatCell ="3,<a href=""userdetail.asp?ID=#ID#"">#FIRSTNAME# #SURNAME#<a>"
onjAxpDB.GridFreeFormatCellByCol(1) = "#FIRSTNAME# #SURNAME#"
onjAxpDB.GridFreeFormatCellByCol(2) = "Phone : #PHONE#, Fax : #FAX#"
onjAxpDB.GridFreeFormatCellByCol(3) = "<a href='mailto:#EMAIL#'>Send mail</a>"
' The following statement is an example of a custom link that can be used to go from Grid to Form Mode.
' It will display as a hyperlink with the data field PRODUCTNAME.
' The #AXPDBFORMURL# generates the URL to the form
objAxpDb.GridFreeFormatCellByCol(2) = "<a href=""#AXPDBFORMURL#"">#PRODUCTNAME#</a>"
Usage:
...
objAxpDB.WriteHtmlTable
If objAxpDB.ErrorMessage<>"" Then Response.Write objAxpDB.ErrorMessage
Set objAxpDbConn = Server.CreateObject("AxpDB.DBConnection")
Notes:
The User Interface for setting column order will be disabled