Click to See Complete Forum and Search --> : SQL Value Loop Question


theflyingminst
03-15-2009, 11:44 AM
Hi I am using Classic ASP And Access and I had a question as to how to make each drop down value found in the database equal an ascending number looped + 1

So the first value would equal value1, the second, value2.. etc.. and so on.

Thanks for taking the time to look at this post.


Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT * FROM Table Order by Table_Field Desc"
oRs.Open strSQL, conn
count=oRs.recordcount

Response.Write "<OPTION VALUE = ''>"
Response.Write "Choose Your Option</Option>"

While not oRs.EOF

if qs = oRs("Field") then
Response.Write "<OPTION VALUE = 'value" & +1 & "' SELECTED>"
Response.Write oRs("Field") & "</Option>"
oRs.MoveNext
else

Response.Write "<OPTION VALUE = '" & +1 & "'>"
Response.Write oRs("Field") & "</Option>"
oRs.MoveNext

End If
Wend

theflyingminst
03-15-2009, 03:34 PM
Found it: http://www.aspwebpro.com/aspscripts/database/countdisplaynumberofrecords.asp