Asp Codes
ActiveX
ADO
Array
Code Snippets
Components
Data Access
Date Time
Files
Graphics
HTML Formatting
Mathematics
Miscellaneous
Sessions
SQL
Strings
Techniques
XML
Asp > Miscellaneous sample source codes
Worlds Fastest Listbox w-Application Data
Worlds Fastest Listbox w-Application Data
listmakedemo.asp</TITLE>
City:
State:
Zip: </BODY></html> ListCity.asp displays listbox of cities. <% If application("list_city")="" Then myDSN="DSN=student;uid=student;pwd=magic" mySQL="select distinct city from publishers" application("list_city")=query2htmlist(mySQL,"cities",myDSN) End If Response.Write application("list_city") %> ListState.asp displays listbox of states <% If application("list_states")="" Then myDSN="DSN=student;uid=student;pwd=magic" mySQL="select distinct state from publishers" application("list_states")=query2htmlist(mySQL,"state",myDSN) End If Response.Write application("list_states") %> ListZip.asp displays listbox ofzips. <% If application("list_zips")="" Then myDSN="DSN=student;uid=student;pwd=magic" mySQL="select distinct zip from publishers" application("list_zips")=query2htmlist(mySQL,"zip",myDSN) End If Response.Write application("list_zips") %> Lib_Listmake.asp Is a library that makes it easier To make listboxes. <% Function query2htmList(myquery,myname,myDSN) Dim conntemp, rstemp Set conntemp=Server.CreateObject("adodb.connection") conntemp.open myDSN Set rstemp=conntemp.execute(myquery) query2HTMlist="
" Do until rstemp.eof thisfield=Trim(RStemp(0)) If IsNull(thisfield) Or thisfield="" Then ' ignore Else query2HTMlist=query2HTMlist & "
" & thisfield & "</option>" End If rstemp.movenext Loop query2HTMlist=query2HTMlist & "</select>" rstemp.close Set rstemp=Nothing conntemp.close Set conntemp=Nothing End Function %> ListMakeClear.asp Is a crude mechanism To force all the listboxes To refresh. It could be invoked On a timed basis (every 15 minutes For example) Or triggered by data-changes. <% application("list_city")="" application("list_states")="" application("list_zips")="" %>
Privacy Policy
|
Link to Us
|
Links