Pls help me to solve ADO-SQL...???
Hi,
I have Access file. "Table1" in this file include one field: Field1, type string.
I am using VB6 to use Database with ADO that following:
Dim db as new Connection
set db = new connection
db.open "...;Data Source = ...\MyDatabase.mdb"
Dim adoTest as new Recordset
if I use statement, for instance:
adoTest.Open "SELECT * FROM Table1 WHERE Field1 like '*abc*';", db,...
then adoTest hasn't got any record.
(if I use: like 'abc' then i'll receive a recordset included records that has 'abc' in Field1)
Please help me. Thanks in advance.
Looking forward to hearing from you.
Best regards,
Dang Ha Vinh
Re: Pls help me to solve ADO-SQL...???
Try using :
SELECT * From Table1 Where Field1 Like '%abc%'
This way, you retrieve records that contain abc anywhere in Field1.
I.E. Use the percent sign instead of the asterisk.
If you want to limit the search, use
SELECT * from Table1 Where Field1 Like 'abc%'
This way, you only retrieve records starting with abc
Re: Pls help me to solve ADO-SQL...???
I suppose you want to obtain any registers with the word 'abc' contained in field1.
So that, I suggest you to use (%) instead of (*)
adoTest.Open "SELECT * FROM Table1 WHERE Field1 like '%abc%';", db,...