Thread View: borland.public.intrabuilder.data.sql
2 messages
2 total messages
Started by Kern Weissman
Fri, 04 Sep 1998 00:00
Problem with MS Access Query & ODBC
Author: Kern Weissman
Date: Fri, 04 Sep 1998 00:00
Date: Fri, 04 Sep 1998 00:00
57 lines
2526 bytes
2526 bytes
I am continuing to have problems passing the below expression utilizing
the "LIKE" operator to MS Access97
When using Borland's Intrabuilder with JavaScript.
The problem is to match a string to the first five characters of a text
field containing zip codes of varying lengths. The following SQL code
when used directly in Access works with no problem. When run it
identifies the record with a six digit zip code "M8Z5T5" by matching the
first five characters.
SELECT metatec.vchr_number, metatec.cust_code, metatec.dzip
FROM metatec
WHERE (((metatec.vchr_number)="C001138") AND
((metatec.cust_code)>="2294000" And (metatec.cust_code)<="2294999") AND
("M8Z5T" LIKE "*" + left((metatec.dzip),5) + "*"));
When I attempted to run it in a form in the intrabuilder as follows, I
received the below error.
form.hidden_Statement.value += "CUST_CODE>='"+name1+"' AND
CUST_CODE<='"+name2+"' AND ('"+name.substring(0,5)+"' LIKE "*" +
left(DZIP,5) + "*" )" ;
}else
Error: Cannot automatically convert data type. The required type is:
Numeric
Removing the asterisks, and using a slightly different syntax caused
this error message. Note there is a typo in the error message "alike"
for "like"
form.hidden_Statement.value += "CUST_CODE>='"+name1+"' AND
CUST_CODE<='"+name2+"' AND '"+name.substring(0,5)+"' LIKE LEFT(DZIP,5)
";
}else
Server Error: [Microsoft][ODBC Microsoft Access 97 Driver] Expression
cannot be
used with the LIKE predicate. in query expression'(VCHR_NUMBER=
'C001138' AND
CUST_CODE>='2294000' AND CUST_CODE<='2294999' AND 'M8Z5T' alike
LEFT(DZIP,5)
)'.
Using slightly different syntax in the form, I got this error.
Server Error: [Microsoft][ODBC Microsoft Access 97 Driver] Expression
cannot be used with the LIKE predicate. in query
expression'(VCHR_NUMBER= 'C001841' AND CUST_CODE>='2294000' AND
CUST_CODE<='2294999' AND ('60188' alike left((DZIP),5) ))'.
Any help would be appreciated
Larry Weissman
larrywm@compuserve.com
Re: Problem with MS Access Query & ODBC
Author: Jeremy Burges
Date: Fri, 04 Sep 1998 00:00
Date: Fri, 04 Sep 1998 00:00
10 lines
963 bytes
963 bytes
Have you tried using the native driver for Access rather than the ODBC one?
I found that I could do a 'LIKE' query using ** with the native driver.
When I tried the ODBC driver I got the same error messages you report.
>Server Error: [Microsoft][ODBC Microsoft Access 97 Driver] Expression
>cannot be used with the LIKE predicate. in query
>expression'(VCHR_NUMBER= 'C001841' AND CUST_CODE>='2294000' AND
>CUST_CODE<='2294999' AND ('60188' alike left((DZIP),5) ))'.
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads