Click here to Skip to main content
15,888,313 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Some Help for a beginner Pin
JimmyRopes7-Jun-07 6:16
professionalJimmyRopes7-Jun-07 6:16 
AnswerRe: Some Help for a beginner Pin
Guffa6-Jun-07 20:46
Guffa6-Jun-07 20:46 
GeneralRe: Some Help for a beginner Pin
Haun the 2nd7-Jun-07 5:52
Haun the 2nd7-Jun-07 5:52 
QuestionEmail problem in PHP Pin
kumar bharat bhusanam6-Jun-07 5:33
kumar bharat bhusanam6-Jun-07 5:33 
AnswerRe: Email problem in PHP Pin
JimmyRopes6-Jun-07 14:22
professionalJimmyRopes6-Jun-07 14:22 
Questionhow can i disable save as and Print option of word 2003 Pin
koolprasad20036-Jun-07 3:04
professionalkoolprasad20036-Jun-07 3:04 
AnswerRe: how can i disable save as and Print option of word 2003 Pin
Fred_Smith6-Jun-07 3:38
Fred_Smith6-Jun-07 3:38 
QuestionDropdownlist problems Pin
matjame6-Jun-07 2:17
matjame6-Jun-07 2:17 
Ok, guys.

I managed to get this code, but the problem is that, it is suppose to create a dropdownlist and populate it with items from a database.I dont get any errors but the staff I request doesnt show either.

Can someone check and give tips.
****************Code**********************
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
Option Explicit

'-- Variables we are using
dim objConn, objRS, objRS2, strSQL

'-- Define our objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS2 = Server.CreateObject("ADODB.Recordset")

'-- Database path and Data provider
objConn.ConnectionString = Server.MapPath("dropdowns.mdb")
objConn.Provider = "Microsoft.Jet.OLEDB.4.0"
objConn.Open

'-- Sub Procedure that builds the dropdown list
Sub showDropDownList(c, r, table)

'-- SQL Statement
strSQL = "SELECT * FROM " & table & " ORDER BY Title ASC"
'-- Execute our SQL statement and store the recordset
Set r = c.Execute(strSQL)

'-- If we have records to return
if r.eof = false then
'-- Open a form/select tag
Response.Write ""
Response.Write "" & vbCrLf
Response.Write "Choose...."
'-- loop and build each database entry as a selectable option
While r.EOF = false
Response.Write "" _
& r.Fields("Title").Value & "" & vbCrLf
'-- Move recordset to the next value
r.movenext
Wend
end if
'-- close select/form tags
Response.Write "" & vbCrLf

End Sub

'-- Sub Procedure that builds the dropdown list
Sub showDropDownList2(c, r, table)

'-- SQL Statement
strSQL = "SELECT * FROM " & table & " ORDER BY Title ASC"
'-- Execute our SQL statement and store the recordset
r.Open strSQL, c, 3, 3

'-- If we have records to return
if r.eof = false then
'-- Open a form/select tag
Response.Write ""
Response.Write "" & vbCrLf
'-- loop and build each database entry as a selectable option
'filter
r.Filter = ("Type = 'fruit'")
Response.Write "Choose...."
Response.Write ""
While r.EOF = false
Response.Write "" _
& r.Fields("Title").Value & "" & vbCrLf
'-- Move recordset to the next value
r.movenext
Wend

r.Filter = adFilterNone

r.Filter = ("Type = 'veg'")
Response.Write ""
While r.EOF = false
Response.Write "" _
& r.Fields("Title").Value & "" & vbCrLf
'-- Move recordset to the next value
r.movenext
Wend
end if
'-- close select/form tags
Response.Write "" & vbCrLf

End Sub
%>




<title>Dynamic dropdown lists in ASP(VBScript) - designplace.org






Dynamic dropdown lists using Active Server Pages and Microsoft Access


Below is an example of a drop down list, dynamically populated from a
database table.




<%
' -- Call the sub procedure to build the drop down list, with the connection and recordset objects and the source table (In quotes).
call showDropDownList(objConn, objRS, "tblDropDownTest")
%>


Here is the same drop down list, but this time it has been filtered to show
fruit first under a heading, then veg.



<%
' -- Call the sub procedure to build the drop down list, with the connection and recordset objects and the source table (In quotes).
call showDropDownList2(objConn, objRS2, "tblDropDownTest")
%>


© designplace.org - Feb 2003




Roll eyes | :rolleyes: Roll eyes | :rolleyes: Roll eyes | :rolleyes: Roll eyes | :rolleyes:

kagiso

AnswerRe: Dropdownlist problems Pin
Guffa6-Jun-07 3:09
Guffa6-Jun-07 3:09 
GeneralRe: Dropdownlist problems Pin
matjame6-Jun-07 22:28
matjame6-Jun-07 22:28 
QuestionDeploying a Web Service to the Server Pin
Richard Andrew x645-Jun-07 10:48
professionalRichard Andrew x645-Jun-07 10:48 
AnswerRe: Deploying a Web Service to the Server Pin
ganti.r6-Jun-07 0:40
ganti.r6-Jun-07 0:40 
GeneralRe: Deploying a Web Service to the Server Pin
Richard Andrew x646-Jun-07 9:06
professionalRichard Andrew x646-Jun-07 9:06 
QuestionWatiN Test Recorder Beta 3 Pin
Daaron5-Jun-07 9:52
Daaron5-Jun-07 9:52 
AnswerRe: WatiN Test Recorder Beta 3 Pin
Christian Graus6-Jun-07 0:42
protectorChristian Graus6-Jun-07 0:42 
AnswerRe: WatiN Test Recorder Beta 3 Pin
Daaron6-Jun-07 3:05
Daaron6-Jun-07 3:05 
QuestionWeb Service Encryption - How? Pin
mikkolaa5-Jun-07 7:45
mikkolaa5-Jun-07 7:45 
AnswerRe: Web Service Encryption - How? Pin
Not Active5-Jun-07 8:21
mentorNot Active5-Jun-07 8:21 
GeneralRe: Web Service Encryption - How? Pin
mikkolaa5-Jun-07 20:31
mikkolaa5-Jun-07 20:31 
Questiongenealogy site recommendation Pin
JimmyRopes5-Jun-07 4:21
professionalJimmyRopes5-Jun-07 4:21 
AnswerRe: genealogy site recommendation Pin
ganti.r6-Jun-07 0:29
ganti.r6-Jun-07 0:29 
GeneralRe: genealogy site recommendation Pin
JimmyRopes6-Jun-07 0:43
professionalJimmyRopes6-Jun-07 0:43 
Questionparent -child forms Pin
ra-rag4-Jun-07 11:59
ra-rag4-Jun-07 11:59 
QuestionDatabase connection Pin
matjame4-Jun-07 0:56
matjame4-Jun-07 0:56 
AnswerRe: Repeater Binding Pin
StianSandberg3-Jun-07 23:44
StianSandberg3-Jun-07 23:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.