Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - returning values from db using pull down
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

returning values from db using pull down

 Post Reply Post Reply
Author
Yama View Drop Down
Newbie
Newbie


Joined: 18 December 2002
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Yama Quote  Post ReplyReply Direct Link To This Post Topic: returning values from db using pull down
    Posted: 15 February 2003 at 10:23pm

I am very new to asp so any help will be greatly appreciated.

I have a very simple access database with one table with 5 fields which are Alarm, description, Action, priority, category.

I have managed to make a pull down menu which is populated from the Alarm column. I have then inserted a database results region using Frontpage (not sure how wise that is!!) which outputs the the  5 fields in a scrolling text area based on the selection that is made from the pull down menu.

The problem is I cannot get the pull menu to give the database results region to take the value and return the results. I know it may be a mistake to try to use the frontpage database function but I am very new to working with asp and databases.

The following is the code on my page. I appologise for the length of my post.

-----------------------------------------------------------

<form method="POST" action="new_test_alarms.asp" name="alarmListing">

 

<select size="1" name="ReefAlarms" bgcolor="#008000" tabindex="1">

<option selected>Select...</option>

<%

strDataSource="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\nkcweb\fpdb\reef_fault_management.mdb; Persist Security Info=False"

set conn = server.createobject ("adodb.connection")

conn.open strDataSource

set RSAlarmDescription = conn.Execute("SELECT Alarm from AlarmDescription ORDER by Alarm")

 

' Populate form pull-down list

Do Until RSalarmdescription.EOF %>

<option value="<% response.write RSalarmdescription("Alarm") %>"><% response.write RSalarmdescription("alarm") %></option>

<%

RSalarmDescription.MoveNext

Loop

' End of Populate

' =================================================================

 

%>

<input type="submit" value="Go" name="B2" tabindex="5"></td>

</form>

<p>&nbsp;</p>

<!--webbot bot="DatabaseRegionStart" startspan

s-columnnames="ID,Alarm,Description,Action,Severity,Category"

s-columntypes="3,203,203,203,3,203" s-dataconnection="Database1"

b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue

b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE"

b-listlabels="TRUE" b-listseparator="TRUE" i-ListFormat="8" b-makeform="TRUE"

s-recordsource="AlarmDescription"

s-displaycolumns="Alarm,Description,Action,Severity,Category"

s-criteria="[Alarm] EQ {Alarm} +" s-order

s-sql="SELECT * FROM AlarmDescription WHERE (Alarm = '::Alarm::')"

b-procedure="FALSE" clientside SuggestedExt="asp" s-DefaultFields="Alarm="

s-NoRecordsFound="No records returned." i-MaxRecords="1" i-GroupSize="0"

BOTID="0" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"

u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="BODY"

local_preview="&lt;table border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Database Results regions will not preview unless this page is fetched from a Web server using a web browser. The section of the page from here to the end of the Database Results region will repeat once for each record returned by the query.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"

preview="<table border=0 width=&quot;100%&quot;><tr><td bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot;><font color=&quot;#000000&quot;>This is the start of a Database Results region. The page must be fetched from a web server with a web browser to display correctly; the current web is stored on your local disk or network.</font></td></tr></table>" --><!--#include file="_fpclass/fpdblib.inc"-->

<%

fp_sQry="SELECT * FROM AlarmDescription WHERE (Alarm = '::Alarm::')"

fp_sDefault="Alarm="

fp_sNoRecords="No records returned."

fp_sDataConn="Database1"

fp_iMaxRecords=1

fp_iCommandType=1

fp_iPageSize=0

fp_fTableFormat=False

fp_fMenuFormat=False

fp_sMenuChoice=""

fp_sMenuValue=""

fp_iDisplayCols=5

fp_fCustomQuery=False

BOTID=0

fp_iRegion=BOTID

%>

<!--#include file="_fpclass/fpdbrgn1.inc"-->

<!--webbot bot="DatabaseRegionStart" i-CheckSum="2326" endspan -->

<form METHOD="POST" >

<!--webbot bot="PurpleText"

PREVIEW="Set this form's properties so it submits user input to the appropriate page."

-->

<table BORDER="0">

<tr>

<td><b>Alarm:</b></td>

<td><textarea NAME="Alarm" ROWS="2" COLS="40"><%=FP_FieldHTML(fp_rs,"Alarm")%></textarea></td>

</tr>

<tr>

<td><b>Description:

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2003 at 8:17am
Are you using frontpage?
Back to Top
peterm View Drop Down
Newbie
Newbie


Joined: 24 November 2002
Location: United Kingdom
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote peterm Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2003 at 10:48am

Hello,

First of all, I recommend you ditch the Frontpage stuff because (imo) it over complicates things with mass code and makes it very hard (especially for newbies) to try and change anything. Hunt through the wealth of asp tutorials and you should be able to get around listing records from a table.

But from what you have, when you submit your form it should go to new_test_alarms.asp. If you open up this page and type the following:

Response.Write Request.Form("ReefAlarms")

You will see that it will return your selected option from the list. (which I gather you wanted to do?)

Any further probs just reply to this thread and im sure someone can help you :)



Edited by peterm
Back to Top
Yama View Drop Down
Newbie
Newbie


Joined: 18 December 2002
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Yama Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2003 at 11:55am

Thank you

Back to Top
Yama View Drop Down
Newbie
Newbie


Joined: 18 December 2002
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote Yama Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2003 at 2:02pm

I have tried it the following way and still nothing. I think I will be doing by trial and error until I can grasp it through my thick head. So in the meantime any assistance would be greatly appreciated.

---------------------------------

<%

strDataSource="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\NKCWeb\fpdb\alarm_management.mdb; Persist Security Info=False"

set conn = server.createobject ("adodb.connection")

conn.open strDataSource

set RSnextgen_alarm_list = conn.Execute("SELECT * FROM nextgen_alarm_list ORDER BY Alarm")

%>

<form METHOD="POST" ACTION="alarm_management_page.asp">

<select Name="Alarmpull">

<option selected>Select...............</option>

<%

 

'****************************This section Loads the drop down menu with Alarm list from database********************************

 

Do Until RSnextgen_alarm_list.EOF %>

<option value="<% response.write RSnextgen_alarm_list("Alarm") %>"><% response.write RSnextgen_alarm_list("alarm") %></option>

<% RSnextgen_alarm_list.MoveNext

Loop

conn.close

'********************************************************************************************************************************

%>

</select>

 

<input TYPE="Submit" Value="Find">

</form>&nbsp;

<p>&nbsp;</p>

<p>&nbsp;</p>

<Form Method="POST">

<%

'***********************In This section I am trying to get the data from the database based on the selection made above*********

strAlarm= request.form("Alarmpull")

strDataSource="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\NKCWeb\fpdb\alarm_management.mdb; Persist Security Info=False"

set conn = server.createobject ("adodb.connection")

conn.open strDataSource

strSQL="SELECT * FROM nextgen_alarm_list WHERE alarm"

set RSALarm = conn.execute(strSQL)

strSQL="SELECT nextgen_alarm_list.description, nextgen_alarm_list.action, nextgen_alarm_list.priority, nextgen_alarm_list.category, "

 set RSretrieved_list = conn.execute(strSQL)

'***********And below I am trying to output the info onto the screen*********

%>

<textarea rows="2" name="S1" cols="20"><%=RSalarm("Alarm") %></textarea>

<textarea rows="6" name="S1" cols="30"><%=RSalarm("description")%></textarea>

<textarea rows="6" name="S1" cols="30"><%=RSalarm("action")%></textarea>

<textarea rows="2" name="S1" cols="20"><%=RSalarm("priority")%></textarea>

<textarea rows="2" name="S1" cols="20"><%=RSalarm("Category")%></textarea>

</Form>



Edited by Yama
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.