Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Problema formato data con script motore ricerca

    Ciao a tutti,
    chiedo un vs. piccolo aiuto per un problema sul quale sto sbattendo la testa ormai da un bel po' di tempo. Sono un novello in asp.
    Ho trovato questo script che di seguito vi allego, un piccolo motore di ricerca che funziona perfettamente con il mio database Access.
    Il mio problema: in questo database ci sono due campi formato data/ora ("datada" e "dataa") che lo script mi visualizza in formato tipo: Sun Jan 8 00:00:00 UTC+0100 2006
    Ho letto in lungo ed in largo nel forum, le ho provate di tutti i colori ma non riesco a far vedere ste date nel formato 08/01/2006.
    Per favore mi date qualche dritta ?
    Grazie

    <%@LANGUAGE = JScript%>
    <%
    Response.Buffer = true;
    var Cn = new ActiveXObject("ADODB.Connection");
    Cn.Open("driver={Microsoft Access Driver (*.mdb)};dbq=" + Server.MapPath("mdb-database/pippo.mdb"));
    var testo = new String(Server.HTMLEncode(Request.Form("cerca")));
    var r_testo = testo.replace(/'/g,"''");
    var cerca = r_testo.split(" "); // Tutte le parole chiave devono essere separate da uno spazio vuoto
    var sql = "SELECT * FROM offerte WHERE ";
    for (var i=0; i<cerca.length; i++)
    {
    if (i > 0) sql += " OR";
    sql += " destinazione LIKE '%" + cerca[i] + "%' OR sottotitolo LIKE '%" + cerca[i] + "%' OR descrizione LIKE '%" + cerca[i] + "%'";
    }
    sql += " ORDER BY destinazione";
    var Mostra = Cn.Execute(sql);
    %>
    <html>
    <head>
    <title>pippo</title>

    <link href="pippo.css" rel="stylesheet" type="text/css">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <body topmargin="0">


    </p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>
    <td width="928" height="18" background="foto/sfofine.gif"> <div align="left">[img]foto/barrapermotore.gif[/img]</div></td>
    </tr>
    </table>


    <font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
    Cerca : <font color="#000066">www.pippo.it</font></font></p>
    <h3>
    <form method="post" action="cerca.asp">
    <input type="text" name="cerca" size="50" value="<%cerca != "undefined" ? Response.Write(testo) : Response.Write("")%>">
    <input type="submit" value="Cerca">
    </form>
    </h3>

    <%if (testo != "undefined") {%>


    <font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">Risultati della ricerca per il termine </font><font color="Red"><%=testo%></font></p>



    <%
    if (testo == "" || testo == "undefined" || testo.charAt(0) == " ")
    {
    Response.Write("

    Inserire un termine per effettuare una ricerca</p>");
    }
    else if (Mostra.EOF)
    {
    Response.Write("

    Nessun risultato</p>");
    }
    else
    {
    while (!Mostra.EOF)
    {
    with (Response)
    {
    Write("

    ");
    Write("[img]" + Mostra("fotogra") + "[/img]" + "
    ");
    Write("" + Mostra("destinazione") + "
    ");
    Write(Mostra("sottotitolo") + "
    ");
    Write("Prezzo:")
    Write("<font color='Blue'>" + Mostra("prezzo") + "</font>" + "
    ");
    Write("Partenza dal: ")
    write("<font color='Blue'>" + Mostra("datada") + "</font>");
    Write(" al: ")
    Write("<font color='Blue'>" + Mostra("dataa") + "</font>" + "
    ");
    Write("</p>");
    }
    Mostra.MoveNext();
    }
    }
    %>
    <%}%>
    </p>


    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td background="foto/sfofine.gif"><p align="right">[img]foto/barrapermotore.gif[/img]</p>
    <p align="left"><font color="#000066" size="1" face="Verdana, Arial, Helvetica, sans-serif">Pippo</font>
    </p>
    </td>
    </tr>
    </table>


    </p>
    </body>
    </html>
    <%Cn.Close()%>

  2. #2
    Qualche anima pia che mi possa dare una mano ? Grazie

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.