/
Forside
/
Teknologi
/
Udvikling
/
VB/Basic
/
Nyhedsindlæg
Login
Brugernavn
*
Kodeord
*
Husk mig
Brugerservice
Kom godt i gang
Bliv medlem
Seneste indlæg
Stil et spørgsmål
Skriv et tip
Pointsystemet
Kontakt Kandu.dk
Emnevisning
Kategorier
Alfabetisk
Karriere
Interesser
Teknologi
Reklame
Top 10 brugere
VB/Basic
#
Navn
Point
1
berpox
2425
2
pete
1435
3
CADmageren
1251
4
gibson
1230
5
Phylock
887
6
AntonV
790
7
strarup
750
8
Benjamin...
700
9
tom.kise
610
10
EXTERMINA..
600
Quote(')-problem in SQL-string
Fra :
Susan
Dato :
13-11-06 15:11
Hello,
I use a Access-db for a music-collection. Using SQL I can make
selections. I do this by using a Text-box.
The problem occurs when Text1.Text contains the character (') single
quote. Like in Sinaed O'connor or T'pau).
The code below makes clear while the problem occurs (syntax).
' ## ---
MyVar = "%" & Text1.Text & "%"
SQLstring = "SELECT * From Albums WHERE Titel LIKE '" & MyVar & "'
ORDER BY Albums.Titel ASC;"
' ## ---
What can I do? Do I have to do a searcha and replace on the
MyVar-value? If so, how? Or is there another solution.
Thanks,
Susan
preben nielsen (
19-11-2006
)
Kommentar
Fra :
preben nielsen
Dato :
19-11-06 21:23
"Susan" <ark312@home.nl> skrev i en meddelelse
news:ej9udv$tjp$1@news1.zwoll1.ov.home.nl...
> Hello,
>
> I use a Access-db for a music-collection. Using SQL I can make
>
> selections. I do this by using a Text-box.
>
> The problem occurs when Text1.Text contains the character (')
> single
>
> quote. Like in Sinaed O'connor or T'pau).
>
> The code below makes clear while the problem occurs (syntax).
SQLstring = "SELECT * From Albums WHERE Titel LIKE '[tag]' ORDER
BY Albums.Titel ASC;"
SQLString = Replace(SQLString, "[tag]", "%" & Text1.Text & "%")
--
/\ preben nielsen
\/\ prel@post.tele.dk
Søg
Alle emner
Teknologi
Udvikling
VB/Basic
Indstillinger
Spørgsmål
Tips
Usenet
Reklame
Statistik
Spørgsmål :
177817
Tips :
31980
Nyheder :
719565
Indlæg :
6410968
Brugere :
218912
Månedens bedste
Årets bedste
Sidste års bedste
Copyright © 2000-2026 kandu.dk. Alle rettigheder forbeholdes.