codice:
<form method="post" action="ricerca.asp">
Inserisci il cognome <input type="text" name="congome" />
<input type="submit" value="CERCA" />
</form>
ricerca.asp
codice:
<%
cognome = request.form("cognome")
if inStr(cognome,"'") > 0 then cognome = replace(cognome,"'","''")
sql = "SELECT * FROM rubrica WHERE cognome = '" & cognome & "'"
' eccetera...
%>
Prova anche queste query:
codice:
' tutto ciò che inizia per il testo digitato
sql = "SELECT * FROM rubrica WHERE cognome LIKE '" & cognome & "%'"
' tutto ciò che contiene il testo digitato
sql = "SELECT * FROM rubrica WHERE cognome LIKE '%" & cognome & "%'"
' tutto ciò che finisce per il testo digitato
sql = "SELECT * FROM rubrica WHERE cognome LIKE '%" & cognome & "'"