Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 28th, 2003, 10:06 PM
Registered User
 
Join Date: Aug 2003
Location: , , Australia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing Multidimensional Array Values back to form

hi ..
Is it possible to pass a multidimensional array values[retrieve form the database] back to a form and only display the first record. When a user click a button[left , right] , i will move through the array and display the values on texboxes using the button onclick event.

===============
Problem ..
===============
When a user enter "Ap" in a textbox, i will goto the database and retrieve a whole list of values[industry, address, postalcode, country .. etc] with Company name that begin with "Ap". I will store all the values in an multidimensional array and when user click a left/right button, i will move through he array and retrieve the values and display in textboxes.


Reply With Quote
  #2 (permalink)  
Old September 4th, 2003, 03:33 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

assuming your using ASP - there are a few methods but you will need to pass the values to, say, hidden form objects and then select the appropriate values to fill in your text boxes.
somthinge like
<input type="hidden" name="name001" value="Company 1" />
<input type="hidden" name="address001" value="Address 1" />
<input type="hidden" name="name002" value="Company 2" />
...
then use your javascript to populate the text boxes to be displayed.

a word of warning if someone types "%%" as a search pattern it would bring all of the data back from the DB and your page could be downloading for ages


Reply With Quote
  #3 (permalink)  
Old June 21st, 2013, 01:59 PM
Registered User
 
Join Date: Jun 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default insert values in Array to card shop in asp

I have some code that I use in sites to enter values ​​in the array, and store in session. This code is very useful for shopping cart in loja virtual:

<%

Function VetorMonta(Acao,Valor)
'Usamos o case para manipular a ação da função
Select Case Trim(Acao)
Case "Incluir"
'Guarda na variavel Vetor o conteudo da Session
Vetor = Session("GuardaVetor")
'Verifica se a Variavel Vetor é um Array, caso nao for entao definimos ela um Array
If Not IsArray(Vetor) Then Vetor = Array() End if
'Verifica se o Valor que esta sendo inserido já esta no Vetor se estiver entao nao inseri para nao haver duplicidades do vetor
If InStr(Join(Vetor), Valor) = 0 Then
'Este comando ira preservar o vetor e adciona + 1 valor
ReDim preserve Vetor(UBound(Vetor)+1)
Vetor(Ubound(Vetor )) = Valor
'Coloca o conteudo da variavel vetor dentro da Session
Session("GuardaVetor") = Vetor
End if
End Select 'Fim do Case
End Function

Function Incluir_Vetor
'Executa a função que ira criar uma posição do vetor, basta passar a acao e o valor
Call VetorMonta("Incluir",Replace(Request("Valor_Vetor" ),"'",""))
Call VetorMonta("Incluir",Replace(Request("tamanho"),"' ",""))
End Function


Function VisualizaValoresVetor
Response.Write "<table border='2'>"
Response.Write "<tr><td>id</td><td>valor</td>"
Response.Write "</tr>"

For x = 0 To ubound(session("GuardaVetor")) 'ira fazer um laço mostrando todos os vetores criados
Response.Write "<tr><td>" & x & "</td>"
Response.Write "<td>" &session("GuardaVetor")(x) & "</td>"
Response.Write "</tr>"
Next
Response.Write "</table>"

'Verifica se a Session tem alguma posição, se tiver mostra a opção de apagar todos os vetores
If ubound(session("GuardaVetor")) >= 0 Then
Response.Write "<br>" &"<a href='vetor.asp?action=LimpaVetor'>Apagar Tudo</a>" & "<br>" 'Imprime o Vetor na tela
End if

End Function


'USAMOS CASES PARA MANUPULARAS CHAMADAS DAS FUNÇÕES
useraction=request("action")
select case useraction
Case "Incluir_Vetor"
'Chama a function que ira incluir um valor para o vetor
Call Incluir_Vetor
End Select
%>
<table width="100%">
<form name="form" method="post" action="?action=Incluir_Vetor">
<tr>
<td><input name="Valor_Vetor" type="text" id="Valor_Vetor"> </td>
<td><input name="tamanho" type="text" >
<input type="submit" name="Submit" value="Incluir no Vetor"></td>
</tr>
</form>
</table>
<%
'Chama a função que vizualiza todos os vetores criados
VisualizaValoresVetor
%>

I use almost all of my sites. I hope you find it useful.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multidimensional array help for a newbie grahama PHP Databases 1 May 13th, 2008 09:41 AM
Multidimensional Array macsham Beginning PHP 2 February 24th, 2005 03:30 PM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM
Multidimensional array in ch9 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 November 2nd, 2004 04:44 PM
Multidimensional Array help grahama Beginning PHP 0 June 12th, 2004 09:01 PM



All times are GMT -4. The time now is 04:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.