Hi, I know this is simple thing but always beats me.
I have this script that works fine, I just want to add a loop so that it returns all the entries instead of just one.
Any pointer would be great, I have tried adding loo and next just not sure of the right way.
Thanks
Richard
I have this script that works fine, I just want to add a loop so that it returns all the entries instead of just one.
Code:
<% ' ADO Constant. Dont change this ' Connection string and SQL statement Dim sql , connStr sql = "Select description FROM tblGreetingPostCards" connStr = " Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/database.mdb" ) ' Opening database Dim rs Set rs = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, connStr, 3, , adCmdText ' Generating random number from total number of records Dim intRnd Randomize Timer intRnd = (Int(RND * rs.RecordCount)) ' Now moving the cursor to random record number rs.Movenext ' Showing the random statement Response.Write " <b><a class=""men"" href=""art.asp?art=" & rs("description") & """>" & rs("description") & " </a></b><br><br>" ' Closing the database rs.Close Set rs = Nothing %>
Thanks
Richard
Comment