Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: How to retrieve the rows from the database based on the select criteria


Message #1 by jeyakumar@h... on Fri, 17 Nov 2000 05:42:12 -0000
Hello!!



1) I am using authors table in the pubs database

2) Displaying all the distinct sates in a select list

3) Based on the selection, I would like to fetch rows in the authors table

and display on the same page.

4) When ever I change the selection, the result should also change on the

same page.



Can anyone help me out on this.



Please note that, If I use other page,I could achieve the same. But my

problem is that, whenever I change the selection criteria, the respective

values should change in the same page not on the different page.



I have enclosed the code to dislay "states". 



tks

Jeya





Code:

<%@ language=vbscript%>

<%

DIM CONSTRING,CON

SET CON = Server.CreateObject("ADODB.CONNECTION")

CONSTRING="Driver={SQL server};"

CONSTRING=CONSTRING & "SERVER=192.168.156.1;DATABASE=PUBS;"

CONSTRING=CONSTRING & "UID=SA;PWD="

CON.Open CONSTRING

dim rec

set rec=CON.Execute("Select distinct state from authors")

%>

<html>

<body>

<form name=f1 action=pubsdatabase.asp method=post>

<%'Display all the distinct states from the authors table using pubs database' %>

Select the State Name<select name=s1 value="">

			 <% while not rec.eof %>

			<option value=<%=rec(0)%>><%=rec(0)%> </option>

			 <%rec.moveNext%>

			<%wend%>

		 </select>

<%rec.close%>

<input type=submit name=submit>

</form>

</body>

</html>



Message #2 by "Ken Schaefer" <ken@a...> on Fri, 17 Nov 2000 18:39:22 +1100
This is a client-side thing, not ASP.



Look here:

http://www.atgconsulting.com/doublelist.asp

or post on a client-side list

(unless you're talking RDS, which is  another kettle of fish...)



Cheers

Ken



(We do have an asp_ado_rds list, and check out the RDS category at http://www.wrox.com/ - moderator)



----- Original Message -----

From: <jeyakumar@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Saturday, November 18, 2000 2:28 AM

Subject: [asp_databases] How to retrieve the rows from the database based on

the select criteria





> Hello!!

>

> 1) I am using authors table in the pubs database

> 2) Displaying all the distinct sates in a select list

> 3) Based on the selection, I would like to fetch rows in the authors table

> and display on the same page.

> 4) When ever I change the selection, the result should also change on the

> same page.

>

> Can anyone help me out on this.

>

> Please note that, If I use other page,I could achieve the same. But my

> problem is that, whenever I change the selection criteria, the respective

> values should change in the same page not on the different page.

>

> I have enclosed the code to dislay "states".

>

> tks

> Jeya




  Return to Index