Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 5th, 2005, 04:47 AM
Friend of Wrox
Points: 686, Level: 9
Points: 686, Level: 9 Points: 686, Level: 9 Points: 686, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Kolkata, West Bengal, India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Working with Arrays

Hi,
I have 2 asp pages a.asp & b.asp. In a.asp I have 2 text boxes for name & age respectively in a form which can be submitted to b.asp. In b.asp I have to retrieve the value of names and ages. I also want to have buttons which when clicked will display the names & ages in a sorted way. I have to test the values sorted in b.asp page for 5-10 values. The values cannot be stored in a database and only arrays have to be used.
What should be the code for storing the names & ages in array and display them in sorted way with the click of buttons.

Please help me.
  #2 (permalink)  
Old October 5th, 2005, 05:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

even though you said you can't use a database, you can still put that array into a recordset, and then muck around with it that way (For example, using .Sort)

I am a loud man with a very large hat. This means I am in charge
  #3 (permalink)  
Old October 8th, 2005, 04:14 AM
Friend of Wrox
Points: 686, Level: 9
Points: 686, Level: 9 Points: 686, Level: 9 Points: 686, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Kolkata, West Bengal, India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Steven,
Probably I could not get what you want to say.It would be better if you help me with the coding, then it might be clear.
  #4 (permalink)  
Old October 11th, 2005, 12:27 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii arnabghosh!!

Not possible without using cookies/sessions/application object.
Since you are not using database for storing previous values.
How could you maintain it using only array in ur b.asp ,since when you come back to your a.asp page, all values in that array will be lost :)
It's better if possible you can post your code



Cheers :)

vinod
  #5 (permalink)  
Old October 20th, 2005, 12:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

vinod yadav1919, I'll have to disagree with you.
QueryStrings can be used!

Arnabghosh,

perhaps this will help:
Code:
Dim strSorter
If Not IsEmpty(Request.QueryString("sort")) Then
  strSorter = Request.QueryString("sort")
Else
  strSorter = "FieldA"
End If
Dim Rs
Set Rs = Server.CreateObject("ADODB.RecordSet")
With Rs
  .Fields.Append "FieldA", 200, 20
  .Fields.Append "FieldB", 200, 20
  .Open

  .AddNew
  .Fields("FieldA") = "FirstName1"
  .Fields("FieldB") = "LastName1"
  .Update

  .AddNew
  .Fields("FieldA") = "FirstName2"
  .Fields("FieldB") = "LastName2"
  .Update
' ...and so on - you could use a possibly loop for this getting the details out of your array such as
  For i=0 to UBound(YourArray, 2)
   .AddNew
   .Fields("FieldA") = YourArray(i,0)
   .Fields("FieldB") = YourArray(i,1)
   .Update
  Next

' or something like that

  .Sort = strSorter
End With

'Then you can actually present your data
Rs.MoveFirst
Do While Not Rs.EOF
 Response.Write Rs(0) & " - " & Rs(1)
 Rs.MoveNext
Loop
Hope this gives you some ideas

I am a loud man with a very large hat. This means I am in charge
  #6 (permalink)  
Old October 20th, 2005, 11:50 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Steven!!
 I agree with you :)


Cheers :)

vinod


Similar Threads
Thread Thread Starter Forum Replies Last Post
Local COM working , but not working at Web Serv nagen111 .NET Web Services 3 February 19th, 2005 04:22 AM
Multidemmesional Arrays OR arrays gmoney060 Classic ASP Basics 3 November 1st, 2004 03:42 PM
Working with arrays created from textbox entries neo_jakey Pro VB 6 1 October 20th, 2004 12:09 PM
Working with arrays created from textbox entries neo_jakey Beginning VB 6 4 September 17th, 2004 02:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.