PDA

Click to See Complete Forum and Search --> : SQL, ADODC ???


SAMS
Aug 4th, 1999, 03:12 PM
Hi, Anyone can help me with this problem?
Currently I'm using ADODC connecting to access. But When i key in the following SQL text, I encounter some problem when i tried both of them, Pls guide me.

Ven - table name
Field1 - Row

(Tried) Code:

Select * FROM Ven WHERE Ven.Field1= "'& Text3.Text & '"

Select * FROM Ven WHERE Field1 = "'& Text3.Text & '"

Both can't work, Is the quotes right?
double quotes comes first then single quote ???

Or is there any another way??
Thks & regards.

preeti
Aug 4th, 1999, 05:19 PM
Hi,

"Select * FROM Ven WHERE Ven.Field1='" & Text3.Text & "'"

[Double Quote]Select * FROM Ven WHERE Ven.Field1=[Single Quote][Double Quote][Space]&[Space]Text3.Text[Space]&[Space][Double Quote][Single Quote][Double Quote]

Hope this helps,

Preeti

SmithVoice
Aug 5th, 1999, 09:13 AM
You'll make your life a lot easier if you stop using single quotes altogether. Use chr(34) instead like:

"SELECT tbl.Fld1 FROM tbl WHERE tbl.Fld2 = " & chr(34) & sCriteria & chr(34)

or

"SELECT tbl.Fld1 FROM tbl WHERE tbl.Fld2 LIKE " & chr(34) & sCriteria & "*" & chr(34)


Now you can forget adding double-doublequotes and accidental double-singlequotes plus you can let users put single and double quotes in the actual text of the fields and they can search with single and double quotes included in the criteria.

Justa thought

-S

------------------
http://www.smithvoice.com/vbfun.htm