The first thing you need to do is create a database called MyDatabase. Then, create a table called tblData with these fields:
ID - autonumber
Item - text field
Next, create a page called displayhoriz.asp and copy the below code into your page:
<% DIM mySQL, objRS mySQL = "SELECT * FROM tblData" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open mySQL, objConn DIM recCount IF Not objRS.EOF THEN Response.Write "
"&objRS("Item")&" | ""&objRS("Item")&" | "
ELSE
Response.Write "Sorry, there are no records in our database."
END IF
%>
This script will return all of the records in your tblData table and display them in a table on your page. Plus, it will display three records horizontally in a table row and then end the current row, start a new row, and display three more records. If you want to display more records horizontally, simply change the "3" in this line: IF recCount Mod 3 = 0 THEN to however many records you want to display in each row.
Happy record displaying!
http://www.aspwebpro.com/aspscripts/database/displayhoriz.asp
No comments:
Post a Comment