fnDisplayRecordset(...) DESCRIPTION This function displays the contents of an ADO recordset on a web-page. A number of formatting options are available. The function also can make the first data column into a query string which can be used to link to another page. The query string (should) contain the values of the primary key fields (so that that record can be selected again in another page). An alternating colour for each row of the recordset can be specified, as can other formatting options. The default 'field-name' column headings can be replaced with new column headings SYNTAX fnDisplayRecordset(ADORecordset, URLstring) EXAMPLE [UNTESTED CODE] <%@ Language=VBScript %> <% Response.Buffer = true %> <% '-->-->-->-->-->-->-->-->--> dim adoConnection dim adoRs sConn = "DRIVER={sql server};SERVER=(local)" set adoConnection = Server.CreateObject("ADODB.connection") adoConnection.Open sConn, "sa", "" adoConnection.DefaultDatabase = "pubs" set adoRs = Server.CreateObject("ADODB.recordset") adoRs.ActiveConnection = adoConnection sQ = "select * from publishers" '--sQ= "select * from authors" adoRs.Open(sQ) Response.Write fnDisplayRecordset(adoRs) '--<--<--<--<--<--<--<--<--< %> RESULTS A formatted HTML table of recordset values (with field names) PARAMETERS adoRs {ADO recordset object}- The recordset to be displayed sLink {string}- a valid relative or absolute url which is used to provide a link for each row of the recordset with a query string. This allows the user to select a particular row. The query string is in the format [fieldname]=[fieldvalue], with the first field in the recordset being taken as the field-names and field-values. aaFormatInfo {Array, optional} Contains all the colour and formatting information for the display STRUCTURE OF ARRAY [0] {boolean} Determines whether the recordset will be displayed in a table with borders or not [1] {string} The background colour of the HTML table which contains the recordset data [2] {string} The text font colour for the display [3] {string} The colour for the alternating row (Used to more clearly distinguish each row from others) set this Array element to the same colour as [1] to have no alternating row colours aaColumnHeadings {Array, optional} Contains titles to use for each column instead of the Table field names. STATUS working, tested a little DEPENDENCIES fnConvertArray [ArrayFunctions.asp] fnErrorMessage [fnErrorMessage.asp] LAST MODIFIED 17 May 2000 PROGRAMMER Matthew Bishop matth3wbishop@yahoo.com) LOCATION http://www.geocities.com/matth3wbishop/eg/asp/ DOCUMENTATION http://www.geocities.com/matth3wbishop/eg/asp/ COMMENTS: a) small utility function b) The query string in the link should have the values of all the primary key fields not just the first field so that same record can be reliably selected in the linked page. c) It may be better to use 'String Lists' rather than arrays for complex parameters to overcome the 'cross-scripting' language problems (instead of fnConvertArray) Bug Reports a) DATE: 13th Dec 2000 AUTHOR: M Bishop DESCRIPTION: The colour formatting parameter does not appear to working b) DATE: 13th Dec 2000 AUTHOR: M Bishop DESCRIPTION: The query string does not extract the primary key for the table c)