Article View: it.comp.www.asp
Article #1Re: Stringa SQL e apici
From: Paolo Di Mauro
Date: Sat, 05 Mar 2022 11:22
Date: Sat, 05 Mar 2022 11:22
16 lines
2503 bytes
2503 bytes
Il giorno mercoledì 23 agosto 2000 alle 09:00:00 UTC+2 Claudio ha scritto:
> > Ho la seguente stringa nel mio codice asp:
> > SQL = "SELECT * FROM tabella WHERE Campo1='" & Request.Form("Campo1") &
> "'"
> Devi semplicemente raddoppiare gli apici che sono contenuti nella tua
> stringa, puoi farlo molto semplicemente con una replace
> campo1 = replace(request.form("campo1"),"'","''")
> SQL = "SELECT * FROM tabella WHERE Campo1='" & Campo1 & "'"
> Dove il primo valore di replace è la stringa in cui deve cercare, il secondo
> è il carattere che deve essere sostiuito cioè ' e il terzo è il carattere
> che verrà sostituito cioè '' (doppio apice singolo e non le vigolette ")
> Vedrai che così funziona :)
> Ciao Claudio
Ottimo !
--
Newsgroup robomoderato - tutti gli articoli sono approvati automaticamente.
Technical Details
Message-ID:
<d4d25f43-43e9-4dfc-8a9b-173f5ca22dc7n@googlegroups.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nnrp.usenet.blueworldhosting.com!!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!not-for-mailReferences:
<8ntu90$js9$1@fe2.cs.interbusiness.it> <8nvurq$abo$1@fe1.cs.interbusiness.it>#1/1> <8nvurq$abo$1@fe1.cs.interbusiness.it>Show Full Headers
Complete Article Headers
Message-ID: <d4d25f43-43e9-4dfc-8a9b-173f5ca22dc7n@googlegroups.com> Subject: Re: Stringa SQL e apici Date: Sat, 05 Mar 2022 11:22:40 +0000 From: Paolo Di Mauro <paolo.dimauro@gmail.com> References: <8ntu90$js9$1@fe2.cs.interbusiness.it> <8nvurq$abo$1@fe1.cs.interbusiness.it>#1/1> <8nvurq$abo$1@fe1.cs.interbusiness.it> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nnrp.usenet.blueworldhosting.com!!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!not-for-mail X-Gm-Message-State: AOAM533eTbtgIVvH/uE1qa20+7dXfhtjQHa29vxiesD6HVERqv3AGN3B 3/gMH7kZBmk+WSO8NHupVFBMcDQ1Je1yQoRq99U= X-Received: by 2002:a37:ea16:0:b0:649:1d8e:3a18 with SMTP id t22-20020a37ea16000000b006491d8e3a18mr1701819qkj.483.1646479361213; X-Received: by 2002:a25:424e:0:b0:628:7c46:3e3e with SMTP id p75-20020a25424e000000b006287c463e3emr2151046yba.166.1646479360773; Sat, 05 Newsgroups: it.comp.www.asp In-Reply-To: <8nvurq$abo$1@fe1.cs.interbusiness.it>#1/1> Injection-Info: google-groups.googlegroups.com; posting-host=2.194.131.132; posting-account=n_33xQoAAADFk16mWNsGjdV4ldTaXwDL User-Agent: G2/1.0 MIME-Version: 1.0 Injection-Date: Sat, 05 Mar 2022 11:22:41 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Approved: robomod@news.nic.it (1.22) Lines: 16 Organization: Robomoderatore (by Md) Sender: robomod@news.nic.it X-Mail-Path: mod-relay.zaccari.net!mail-qk1-f199.google.com!news@google.com X-Original-NNTP-Posting-Host: 2.194.131.132 X-Received-Bytes: 3319