Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Data in ASP

Status
Not open for further replies.

aishaaa

Programmer
May 1, 2002
21
0
0
AE
Hi,

any idea how to filter data extracted from DB "table" in ASP
 
If your are using RDC you could filter the cleint side recordset, you could also do the same thing with an XML dataset, but if you are using plain old ado, and server side recordsets, it is called a WHERE clause in your select statement. If you are bringing back an entire table, but only displaying x records you are causing huge performance problmems.
 
SELECT SomeColumn FROM SomeTable WHERE SomeCondition
 
required: more info



Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
I think thats called a "Query" :)

more info..hmm.. yes, please. will do very well, yes

1H 1K 10 3D 3F 3E 3K 38 3J 10 1T 10 3G 3L 3I 35 10 35 3O 33 35 3C 3C 35 3E 33 35

brickyard.jpeg
Most intense event I ever attended!
 
You can use the Filter property of your Recordset Object, wich in my opinion is more eficinet then creat another recordset for every option you filter.

adOpenStatic = 3
adUseClient = 3
adLockPessimistic = 2
set conn=Server.CreateObject("ADODB.Connection")
...

set rs=Server.CreateObject("ADODB.Recordset")
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockPessimistic
rs.Source = "select * from myTable"
rs.ActiveConnection = conn
rs.Open
...
'filtering after age=25 lets say
rs.Filter="age=25"
'now you have other properties for the rs Object
'like new RecordCount and Bof, Eof values
while not rs.EOF
'do your job
rs.MoveNext
wend

________
George, M
 
rs.Source = "select * from myTable WHERE age=25"


make the filters part of your query
 
Thanks a lot all ... but shaddow am getting error in the
rs.activeconnection = conn ..

do u have idea how to sort the extract or downloaded data to excel sheet .. i want to sort the currency and banks


thanks again
 
This line wont work "rs.ActiveConnection = conn" if you didnt opened the connexion.
And you can sort it on the querry like Digimon02 sayed


________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top