![]() |
|
|
Alternate Row ColorsThe code below will display the results from a database in alternate table row colors. The code uses the VBScript Mod operator. The VBScript Mod operator divides two numbers and returns the remainder. So in our code if our iRow counter is divisible by 2 leaving a remainder of 0 then we set the table row to <tr bgcolor=""#F7F7F7"">. <%@ 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"">" response.write "</tr>" End If 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. |
|