Ciao ragazzi, ecco il quesito:
Ho un db che si chiama data.mdb. Al suo interno, ci sono tre tabelle:
prodotti_it
chisiamo_it
notizie_it
Ognuna delle tre tabelle ha un solo campo chiamato TESTO all'interno del quale c'è il contenuto testuale che verrà visualizzato nelle pagine PRODOTTI, CHI SIAMO E NOTIZIE.
Vorrei mettere un campo di ricerca legato al database....
Ho il form:
-------------------------------------------------------------------
<form name="form1" method="post" action="buttare.asp?cerca=ok">
<input type="text" name="parola" id="parola">
<input type="submit" value="Cerca">
</form>
<%
parola=request.form("parola")
ok=request.QueryString("cerca")
if ok <>"" then
Set Conn=Server.CreateObject("ADODB.Connection")
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data.mdb")
Conn.Open strConn
sql = "select * from chisiamo_it where testo LIKE '%" & parola & "%' union select * from prodotti_it where testo LIKE '%" & parola & "%' union select * from notizie_it where testo LIKE '%" & parola & "%'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql, conn, 3,3
if not RS.EOF then
response.write rs("testo")&"
<hr>"
else
response.write "ciao"
end if
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
end if
%>
con questa stringa, vorrei interrogare le tre tabelle del db:
-----------------------------------------------------------------------------------
sql = "select * from chisiamo_it where testo LIKE '%" & parola & "%' union select * from prodotti_it where testo LIKE '%" & parola & "%' union select * from notizie_it where testo LIKE '%" & parola & "%'"
Poi vorrei che venissero visualizzati i risultati nel seguente modo:
testo trovato con la ricerca
Mi aiutate?????????????
Sarà che è venerdì sera, ma non ne vengo fuori....)
Grazie in anticipo... e buon WE

)
Rispondi quotando
