Re: SQL SELECt with ' in filter name
- From: "Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom>
- Date: Thu, 15 Jun 2006 15:50:57 +0100
"Khalid Rahaman" <KhalidRahaman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:972A1E89-6FCB-47AA-921B-3BB6977EB8B0@xxxxxxxxxxxxxxxx
I am trying to filter a recordset using the following SQL statement
SELECT * FROM 'cars.sold' where seller='" & txtSellername.text & "'"
the txtsellername.text refers to a texbox on the VB form which enters the
name i want to filter by.
This works great for everything except when the variable contains an ' in
the textbox for example "Joe's Auto".
You need to parse txtSellername.text and double up single quotes when
present.
It would be easy to write a VB function that does this
FUNCTION SQLEscape$(Intext$)
'code here
END FUNCTION
and then do
SELECT * FROM 'cars.sold' where seller='" & SQLEscape(txtSellername.text) &
"'"
Stephen Howe
.
- Prev by Date: Re: SQL SELECt with ' in filter name
- Next by Date: Re: ADO error
- Previous by thread: Re: SQL SELECt with ' in filter name
- Next by thread: Re: SQL SELECt with ' in filter name
- Index(es):
Relevant Pages
|
|