![]() |
|
|
Display your Recordset in a 3 column Table LayoutThe code below retrieves a recordset from our "tblFriends" table in the database 'Friends.mdb'. The table has 3 columns, firstly an 'ID' field that is an autonumber, secondly a field called 'FirstName' which is a textfield and lastly another textfield called 'SurName'. The code displays the results in a 3 column table layout. If you wish to change the number of columns displayed then simply change the line If iColumnSpan=3 Then to the number of columns you want. <%@ Language="VBScript" %> 'declare SQL statement that will query the database 'define the connection string, specify database
'create an ADO connection and recordset 'Open the connection to the database 'Open the recordset object, execute the SQL statement 'first of all determine whether there are any records Response.write "<table width=""100%""
border=""1"">" iColumnSpan=iColumnSpan + 1 'move on to the next record response.write "</tr>" End If
Alternatively you could create a 3 column layout using the VBScript Mod Operator If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site. Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|