Ho creato due campi di ricerca con il seguente metodo:
Dim Keyword, Keyword02, SQL, j, TheSet, ConnObj, iResultCount
Keyword = trim(replace(Request.Form("keyword"),"'","''",1))
Keyword02 = trim(replace(Request.Form("keyword02"),"'","''",1) )
SQL = "SELECT Top 3000 * FROM tabella WHERE "
If Keyword <> "" then
SQL = SQL & "tabella.descrizione LIKE '%" & Keyword & "%' AND "
End if
If Keyword02 <> "" then
SQL = SQL & "tabella.Provincia = '" & Keyword02 & "' OR "
SQL = SQL & "tabella.Prov = '" & Keyword02 & "' OR "
SQL = SQL & "tabella.Citta = '" & Keyword02 & "' OR "
SQL = SQL & "tabella.Regione = '" & Keyword02 & "' OR "
End if
.... ecc.
Il tutto funziona correttamente.
Il mio problema è come mettere un controllo che obblighi ad inserire almeno un elemento di ricerca. Così come è adesso se un utente non inserisce niente ed avvia la ricerca, vengono fuori tutti i contenuti.
Grazie...

Rispondi quotando
