fnSimpleUpdateRecord(...) DESCRIPTION This function returns an HTML string to display and update one record from a database table on a webpage. The record is formatted as an HTML table. The labels for the fields of the data can be specified as can the colours used in the display. SYNTAX <%= fnSimpleUpdateRecord(DataConnection, OpenString, [InputTypeArray], [TableName], [LablesArray], [ColoursArray], [ConnectionArray], %> EXAMPLE <%@ Language=VBScript %> <% Response.Buffer = true %> <% '-->-->-->-->-->-->-->-->--> dim adoCon dim sQuery set adoCon = Server.CreateObject("ADODB.connection") adoCon.Open "DRIVER={SQL Server};SERVER=(local)", "sa", "" adoCon.DefaultDatabase = "pubs" sQuery = "SELECT * " & _ "FROM publishers " Response.Write fnSimpleUpdateRecord(adoCon, sQuery) set adoCon = nothing '--<--<--<--<--<--<--<--<--< %> RESULTS The output is a formatted table containing the data from the record selected from the table. The data can updated using the input boxes PARAMETERS adoConnection- This is the ADO connection to the database strOpen {string}- This is used to open the recordset If the recordset contains more than one record, then only the first record will be displayed. [aaFieldInfo] {One Dimensional array} This contains information about what sort of input box is to be used for each field of the record. 0: The field of the recordset is invisible 1: Read Only 2: Text Box 3: Password Box 4 Date Picker (Default: all non aggregated, identity, or concatenated fields will be text boxes) [aaLabels] {array}- This contains the labels to be used for each of the fields for the table record, including the title which will be used for the record display. (Default: the field-names for the table.) aaLabels[0] the title for the data record aaLabels[n] the labels for the fields of the data. [aaColourInfo] {array}- This provides the information for what colours to use in the record display (Default: Black on white) aaColourInfo[0] the background colour for the html table aaColourInfo[1] the background colour for the labels cells aaColourInfo[2] the background colour for the values cells. aaColourInfo[3] the font colour for the labels. aaColourInfo[4] the font colour for the values. [aaConnect]- This is an array containing the information which is to be used to open the database. This parameter is only used if an open connection is not passed (ooConnection parameter). . aaConnect[0] The database driver type (default: 'sql server') aaConnect[1] The IP of the server (default: '(local)') aaConnect[2] The user name (default: 'sa') aaConnect[3] The password for that user (default: 'max') aaConnect[4] The database name. TO DO [aaFormatInfo] {Array, optional} This array determines how the display table is to be formatted. For EXAMPLE whether it is to have a border, cellpadding etc STRUCTURE: [0] {boolean} Determines whether the html table has a border [1] {integer} The cell padding for the table [2] {integer} The cell spacing for the table STATUS partially working, tested very little (no passwords or DATEpickers yet) untested for multiple primary keys DEPENDENCIES fnErrorMessage (fnErrorMessage.asp) fnConnectToDatabase (fnDataSELECT.aap) fnConvertArray (ArrayFunctions.asp) LAST MODIFIED 16 April 2000 PROGRAMMER Matt" Response.Write _ fnSimpleUpdateRecord("select * from Authors", nothing, aaCon, aaL) '--<--<--<--<--<--<--<--<--< %> RESULTS