Click here to Skip to main content
15,887,683 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: ASP.Net Stored Procedure Pin
_AK_10-Jun-07 21:10
_AK_10-Jun-07 21:10 
QuestionPrevent File-> save as Pin
Mri1a8-Jun-07 1:32
Mri1a8-Jun-07 1:32 
AnswerRe: Prevent File-> save as Pin
Christian Graus8-Jun-07 1:41
protectorChristian Graus8-Jun-07 1:41 
AnswerRe: Prevent File-> save as Pin
Shog98-Jun-07 5:56
sitebuilderShog98-Jun-07 5:56 
GeneralRe: Prevent File-> save as Pin
Johnny ²8-Jun-07 9:47
Johnny ²8-Jun-07 9:47 
GeneralRe: Prevent File-> save as Pin
Christian Graus10-Jun-07 13:45
protectorChristian Graus10-Jun-07 13:45 
AnswerRe: Prevent File-> save as Pin
Bradml9-Jun-07 0:41
Bradml9-Jun-07 0:41 
QuestionStill have problems with dropdownlist Pin
matjame8-Jun-07 0:44
matjame8-Jun-07 0:44 
Hi all.

I managed to get this code but cant tell why it doesnt show the results.Its suppose to display the dropdownlist with all the values from the database.

<%@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("C:\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 " & tblDropDownTest & " 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
else
response.write"<"Sorry, no records selected">"
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 " & tblDropDownTest & " 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")
Sub showDropDownList(c, r, table)

'-- SQL Statement
strSQL = "SELECT * FROM " & tblDropDownTest & " 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
else
response.write"<"Sorry, no records selected">"
end if
'-- close select/form tags
Response.Write "" & vbCrLf

End Sub
%>


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






Frown | :(

kagiso

AnswerRe: Still have problems with dropdownlist Pin
Viral Upadhyay8-Jun-07 3:57
Viral Upadhyay8-Jun-07 3:57 
AnswerRe: Still have problems with dropdownlist Pin
hiral_shah8-Jun-07 19:50
hiral_shah8-Jun-07 19:50 
QuestionFILE input field Pin
Aleksandar Cajic7-Jun-07 23:46
Aleksandar Cajic7-Jun-07 23:46 
AnswerRe: FILE input field Pin
Guffa8-Jun-07 10:26
Guffa8-Jun-07 10:26 
QuestionConverting Request object to WebRequest in asp.net Pin
amitar277-Jun-07 9:18
amitar277-Jun-07 9:18 
AnswerRe: Converting Request object to WebRequest in asp.net Pin
Guffa8-Jun-07 9:45
Guffa8-Jun-07 9:45 
QuestionBest Shopping cart for use in Canada? Pin
Leftyfarrell7-Jun-07 8:01
Leftyfarrell7-Jun-07 8:01 
QuestionWhat language/technology should I use? Pin
RX Maverick7-Jun-07 7:49
RX Maverick7-Jun-07 7:49 
AnswerRe: What language/technology should I use? Pin
Leftyfarrell7-Jun-07 8:05
Leftyfarrell7-Jun-07 8:05 
AnswerRe: What language/technology should I use? Pin
badgrs8-Jun-07 0:33
badgrs8-Jun-07 0:33 
AnswerRe: What language/technology should I use? Pin
Shog98-Jun-07 5:59
sitebuilderShog98-Jun-07 5:59 
QuestionInternet application proxy Pin
amitar277-Jun-07 1:58
amitar277-Jun-07 1:58 
AnswerRe: Internet application proxy Pin
JimmyRopes8-Jun-07 9:16
professionalJimmyRopes8-Jun-07 9:16 
QuestionProblem with AJAX Pin
haasini7-Jun-07 1:13
haasini7-Jun-07 1:13 
AnswerRe: Problem with AJAX Pin
szukuro7-Jun-07 1:52
szukuro7-Jun-07 1:52 
GeneralRe: Problem with AJAX Pin
haasini7-Jun-07 2:32
haasini7-Jun-07 2:32 
GeneralRe: Problem with AJAX Pin
szukuro7-Jun-07 3:50
szukuro7-Jun-07 3:50 

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.