Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 23

Discussione: Aiuto ricerca in asp

  1. #1

    Aiuto ricerca in asp

    Ciao Ragazzi, premetto che sono il solito duro e
    non ne capisco quasi niente di asp, un amico
    mi ha fatto un paio di pagine in asp (con dreamweaver) collegate ad
    un db access, mi ha inserito dei campi nella pagina di visualizzazione per fare
    delle ricerche nel db, una form per ogni campo, in uno (a discesa)
    ho una serie di valori, "Paesaggi,Particolari, La natura, Le città,La vita, Le tradizioni," (è una raccolta fotografica)che indicano la categoria di quel record...
    tutto funziona alla perfezione, però io non riesco a fare questo:
    se volessi fare un elenco nella pagina tipo
    Paesaggi
    Particolari
    La natura
    Le città
    La vita
    Le tradizioni

    come faccio a linkare il testo in modo che il risultato sia lo stesso
    che ottengo scegliendo una di queste voci nel form a discesa????

    c'è qualcuno che mi da un'aiuto GRAZIE...

    vi posto il codice:

    è un bel pò di roba ma non so proprio come fare....:
    ____________________________
    <%
    ' definisce una variabile con il numero di record da visualizzare ################################################## #########
    Dim NumRecVisibili
    NumRecVisibili=1
    ' ################################################## ################################################## #######################

    Dim reElenco2
    Dim reElenco2_numRows

    Set reElenco2 = Server.CreateObject("ADODB.Recordset")
    reElenco2.ActiveConnection = MM_database_STRING
    reElenco2.Source = "SELECT * FROM foto ORDER BY id DESC"
    reElenco2.CursorType = 0
    reElenco2.CursorLocation = 2
    reElenco2.LockType = 1
    reElenco2.Open()

    reElenco2_numRows = 0
    %>
    <%
    Dim rsCol2
    Dim rsCol2_numRows

    Set rsCol2 = Server.CreateObject("ADODB.Recordset")
    rsCol2.ActiveConnection = MM_database_STRING
    rsCol2.Source = "SELECT * FROM foto ORDER BY id DESC"
    rsCol2.CursorType = 0
    rsCol2.CursorLocation = 2
    rsCol2.LockType = 1
    rsCol2.Open()

    rsCol2_numRows = 0
    %>
    <%
    Dim rsUltimo__MMColParam
    rsUltimo__MMColParam = "1"
    If (Request.QueryString("id") <> "") Then
    rsUltimo__MMColParam = Request.QueryString("id")
    End If
    %>
    <%
    Dim rsCol3__MMColParam
    rsCol3__MMColParam = "si"
    If (Request("MM_EmptyValue") <> "") Then
    rsCol3__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim rsCol3
    Dim rsCol3_numRows

    Set rsCol3 = Server.CreateObject("ADODB.Recordset")
    rsCol3.ActiveConnection = MM_database_STRING
    rsCol3.Source = "SELECT * FROM foto WHERE record_in_vista = True ORDER BY id DESC"
    rsCol3.CursorType = 0
    rsCol3.CursorLocation = 2
    rsCol3.LockType = 1
    rsCol3.Open()

    rsCol3_numRows = 0
    %>
    <%
    Dim rsUltimo
    Dim rsUltimo_numRows

    Set rsUltimo = Server.CreateObject("ADODB.Recordset")
    rsUltimo.ActiveConnection = MM_database_STRING
    rsUltimo.Source = "SELECT * FROM foto WHERE id = " + Replace(rsUltimo__MMColParam, "'", "''") + ""
    rsUltimo.CursorType = 0
    rsUltimo.CursorLocation = 2
    rsUltimo.LockType = 1
    rsUltimo.Open()

    rsUltimo_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = 10
    Repeat1__index = 0
    rsCol2_numRows = rsCol2_numRows + Repeat1__numRows
    %>

    POI HO I CAMPI DI RICERCA ALL'INTERNO DELLA PAGINA:

    <td bgcolor="#99CC99"> <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">RICERCA
    UNA FOTO
    </font></div></td>
    </tr>
    <tr>
    <td> <div align="left" class="style9">
    <form name="form1" method="post" action="fotoe.asp">
    <table width="99%" border="0" align="left">
    <tr>
    <td width="84%" height="26" colspan="2"><div align="center"><span class="style5"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font size="1" face="Arial, Helvetica, sans-serif">Cerca
    una foto per nome</font>
    </font> <font size="1" face="Arial, Helvetica, sans-serif">
    <input name="fnd_oggetto" type="text" id="fnd_oggetto" size="12" maxlength="255">
    </font>

    <input type="submit" name="Submit2" value="cerca">
    </span> </div></td>
    </tr>
    </table>
    </form>


    </div></td>
    </tr>
    <tr>
    <td> <div align="left">
    <form name="form1" method="post" action="fotoe.asp">
    <table width="99%" border="0" align="left">
    <tr>
    <td width="84%" height="26" colspan="2"><div align="center"><span class="style5"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font size="1" face="Arial, Helvetica, sans-serif">Cerca
    nella descrizione</font>

    </font>
    <input name="fnd_testo" type="text" id="fnd_testo3" size="12" maxlength="255">
    <input type="submit" name="Submit" value="cerca">
    </span> </div></td>
    </tr>
    </table>
    </form>
    </div></td>
    </tr>
    <tr>
    <td> <div align="left" class="style9">
    <form name="form1" method="post" action="fotoe.asp">
    <table width="99%" border="0" align="left">
    <tr>
    <td width="84%" height="26" colspan="2"><div align="center"><span class="style5"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font size="1" face="Arial, Helvetica, sans-serif">Cerca
    per Tipo
    </font>

    </font> </span><span class="style8">
    <select name="fnd_web" size="1" id="fnd_web">
    <option>Paesaggi</option>
    <option>Particolari</option>
    <option>La natura</option>
    <option>Le citt&agrave;</option>
    <option>La vita</option>
    <option>Le tradizioni</option>
    </select>
    </span><span class="style5">
    <input type="submit" name="Submit3" value="cerca">
    </span></div></td>
    </tr>
    </table>
    </form>
    </div></td>

    __________________________________________________ ___

  2. #2
    beh da quel codice si capisce ben poco... cmq sia se come hai detto le immagini sono divise per qualche genere di criterio di ricerca, basta che aggiungi alla fine della select "WHERE nomecampo = criterio"

    Matrix è ovunque, è intorno a noi, anche adesso nella stanza in cui siamo. È quello che vedi quando ti affacci alla finestra o quando accendi il televisore. L'avverti quando vai al lavoro, quando vai in chiesa, quando paghi le tasse. È il mondo che ti è stato messo dinanzi agli occhi, per nasconderti la verità.

  3. #3

    Aiuto ricerca asp c'è una buon anima che mi aiuta?

    ragazzxi c'è qualcuno che mi aiuta. ZeroCool981 ti ringrazio ma ho provato a passare la select ma non va o sbaglio qualcosa,
    una volta avevo una paginetta asp simile a questa con codice diverso
    inserivo nel link esempio:
    dfoto.asp?=campo=il valore e mi filtrava il dato...

    ora la pagina che dovrei linkare è fotoe.asp

    che nella select ha questi valori:

    <%
    Dim reElenco__MMColParam
    reElenco__MMColParam = "%"
    If (Request.Form("fnd_oggetto") <> "") Then
    reElenco__MMColParam = Request.Form("fnd_oggetto")
    End If
    %>
    <%
    Dim reElenco__MMColParam1
    reElenco__MMColParam1 = "%"
    If (Request.Form("fnd_testo") <> "") Then
    reElenco__MMColParam1 = Request.Form("fnd_testo")
    End If
    %>
    <%
    Dim reElenco__MMColParam2
    reElenco__MMColParam2 = "%"
    If (Request.Form("fnd_varie") <> "") Then
    reElenco__MMColParam2 = Request.Form("fnd_varie")
    End If
    %>
    <%
    Dim reElenco__MMColParam3
    reElenco__MMColParam3 = "%"
    If (Request.Form("fnd_web") <> "") Then
    reElenco__MMColParam3 = Request.Form("fnd_web")
    End If
    %>

    <%
    Dim reElenco
    Dim reElenco_numRows

    Set reElenco = Server.CreateObject("ADODB.Recordset")
    reElenco.ActiveConnection = MM_database_STRING
    reElenco.Source = "SELECT * FROM foto WHERE oggetto LIKE '%" + Replace(reElenco__MMColParam, "'", "''") + "%' AND testo LIKE '%" + Replace(reElenco__MMColParam1, "'", "''") + "%' AND varie LIKE '%" + Replace(reElenco__MMColParam2, "'", "''")+ "%' AND web LIKE '%" + Replace(reElenco__MMColParam3, "'", "''")+ "%' ORDER BY id DESC"
    reElenco.CursorType = 0
    reElenco.CursorLocation = 2
    reElenco.LockType = 1
    reElenco.Open()

    reElenco_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = 4
    Repeat1__index = 0
    reElenco_numRows = reElenco_numRows + Repeat1__numRows
    %>

    e funzionano da una ricerca fnd_campo da un form a discesa
    cosa devo cambiare nella select per linkare delle voci nella pagina invece che scegliere da un campo a discesa???


    aiutooo

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Al posto di request.Form prova a mettere solo Request

    Roby

  5. #5
    ho provato a sostituire il request.form con solo request

    così:
    <%
    Dim reElenco__MMColParam
    reElenco__MMColParam = "%"
    If (Request("fnd_oggetto") <> "") Then
    reElenco__MMColParam = Request("fnd_oggetto")
    End If
    %>
    <%
    Dim reElenco__MMColParam1
    reElenco__MMColParam1 = "%"
    If (Request("fnd_testo") <> "") Then
    reElenco__MMColParam1 = Request("fnd_testo")
    End If
    %>
    <%
    Dim reElenco__MMColParam2
    reElenco__MMColParam2 = "%"
    If (Request("fnd_varie") <> "") Then
    reElenco__MMColParam2 = Request("fnd_varie")
    End If
    %>
    <%
    Dim reElenco__MMColParam3
    reElenco__MMColParam3 = "%"
    If (Request("fnd_web") <> "") Then
    reElenco__MMColParam3 = Request("fnd_web")
    End If
    %>


    poi ho fatto un link in una pagina a questa :

    dfoto.asp?web=Paesaggi

    ma il risultato è un errore 500 interno al server...

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Su IE Menu strumenti --> opzioni internet --> Avanzate e declicca la voce "Mostra messaggi di errore HTTP brevi".
    Fai ripartire la pagina e guarda l'errore.

    Roby

  7. #7
    questo è l'errore:

    Microsoft VBScript compilation error '800a03ee'

    Expected ')'

    dfoto.asp, line 130

    If (Request"fnd_web") <> "") Then
    -----------^

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Manca un aparentesi dipo Request:

    codice:
    If (Request("fnd_web") <> "") Then
    Roby

  9. #9
    ora va avanti e si ferma alla riga 354 ecco l'errore:

    Microsoft VBScript runtime error '800a01b6'

    Object doesn't support this property or method

    dfoto.asp, line 354

    dove alla 354 e giu c'è:

    ' add the Form variables to the MM_keepForm string
    For Each MM_item In Request
    MM_nextItem = "&" & MM_item & "="
    If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request(MM_item))
    End If
    Next

    ' create the Form + URL string and remove the intial '&' from each of the strings
    MM_keepBoth = MM_keepURL & MM_keepForm
    If (MM_keepBoth <> "") Then
    MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
    End If
    If (MM_keepURL <> "") Then
    MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
    End If
    If (MM_keepForm <> "") Then
    MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
    End If

    ' a utility function used for adding additional parameters to these strings
    Function MM_joinChar(firstItem)
    If (firstItem <> "") Then
    MM_joinChar = "&"
    Else
    MM_joinChar = ""
    End If
    End Function
    %>
    <%
    ' *** Move To Record: set the strings for the first, last, next, and previous links

    Dim MM_keepMove
    Dim MM_moveParam
    Dim MM_moveFirst
    Dim MM_moveLast
    Dim MM_moveNext
    Dim MM_movePrev

    Dim MM_urlStr
    Dim MM_paramList
    Dim MM_paramIndex
    Dim MM_nextParam

    MM_keepMove = MM_keepBoth
    MM_moveParam = "index"

    ' if the page has a repeated region, remove 'offset' from the maintained parameters
    If (MM_size > 1) Then
    MM_moveParam = "offset"
    If (MM_keepMove <> "") Then
    MM_paramList = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For MM_paramIndex = 0 To UBound(MM_paramList)
    MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
    If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
    MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
    End If
    Next
    If (MM_keepMove <> "") Then
    MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
    End If
    End If

    ' set the strings for the move to links
    If (MM_keepMove <> "") Then
    MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
    End If

    MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="

    MM_moveFirst = MM_urlStr & "0"
    MM_moveLast = MM_urlStr & "-1"
    MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
    If (MM_offset - MM_size < 0) Then
    MM_movePrev = MM_urlStr & "0"
    Else
    MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
    End If


    ________________________

    dammi un'occhiata mi fai un gran favore! grazie ancora

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    L'occhiata l'ho data ma non si capisce un tubo!

    Roby

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.