 |
menny Level: Protégé
 Registered: 02-12-2004 Posts: 5
|
Recordset "LIKE" filter of a number column
Hello,
i'm trying to do a LIKE filter to a numeric column.
the idea is that i could make a LIKE filter just as i would on a varchar column.
any ideas?
|
|
02-12-2004 at 08:21 AM |
|
|
b marshall Level: Graduate
 Registered: 28-10-2004 Posts: 11
|
Re: Recordset "LIKE" filter of a number column
Did you try using % as part of your LIKE filter? For example, if you wanted all numbers that begin with a 12 then you would enter something like the following:
SELECT ....... FROM .........WHERE ...... LIKE '12%'
If that doesnt answer your question then please explain in more detail...
|
|
|
02-12-2004 at 02:29 PM |
|
|
menny Level: Protégé
 Registered: 02-12-2004 Posts: 5
|
Re: Recordset "LIKE" filter of a number column
I'll explain in details.
i want to use ADO Recordset's Filter property to remove unwanted rows from the recordset.
I want to do it in the recordset (in RAM) and not to re-query the SQL server.
The Recordset object has a property called "Filter" which gives a quick way to filter the rows.
but this property is not 100% SQL. therefore, it does not support LIKE statement for numeric columns.
i'm looking for a way to do it anyway (maybe some mathematical way....)
btw, the simple LIKE statement with % or * does not work.
thanks.
|
|
02-12-2004 at 03:09 PM |
|
|
menny Level: Protégé
 Registered: 02-12-2004 Posts: 5
|
Re: Recordset "LIKE" filter of a number column
Hi.
your code did not work for me.
does your "fieldname" column is a numeric column?
in my table, the column is a "int" type.
therefore, "LIKE" is not posible on it.
i'm looking for a trick or something that will allow me to do it or simulate it.
thanks
|
|
05-12-2004 at 12:10 PM |
|
|
menny Level: Protégé
 Registered: 02-12-2004 Posts: 5
|
Re: Recordset "LIKE" filter of a number column
Hi yronium,
What version of VB have you tried it on?
i'm using VB6 SP5.
Does the column "fieldname" (in your tests) is a numeric column (int,lomg, etc) ?
|
|
05-12-2004 at 01:37 PM |
|
|
menny Level: Protégé
 Registered: 02-12-2004 Posts: 5
|
Re: Recordset "LIKE" filter of a number column
Hi.
i've tried the code you suggested.
all four does not work.
the ones without the ' char does not cause error, but also does not filter.
any other ideas? i'll gladly try more
thanks
|
|
06-12-2004 at 07:41 AM |
|
|
BON Level: Trainee
 Registered: 12-08-2009 Posts: 1
|
Re: Recordset "LIKE" filter of a number column
hi try this it may help
its for vb6
retrieve the data and convert it to string
then use the like "%" statement
dim phone as string
phone=text1.text
'whether the data in text1 is numeric or char
'all is handled as string
datacontrol.comandtype=adcmdtext
dtacontrol.recordsource="select_from _ where _ like'"+phone+"%'"
datacontrol.refresh
ben
____________________________
Its all possible
|
|
12-08-2009 at 02:59 PM |
|
|
|
|
 |
 |