Solved

Invalid use of '.', '!', or '()'. in query expression

Posted on 2002-06-26
3
759 Views
Last Modified: 2013-12-24
Hello and thanks in advance. I'm performing a very basic query where I'm checking a value against my db. I'm performing the following query:

<cfquery name="usercode_entry" datasource="#request.db#">
SELECT Usercode
FROM Codes
WHERE Usercode = '#Trim(FORM.Usercode)#'
</cfquery>

Some of the usercodes are formatted as such --> A.60203. I get the following error when a value such as the one above is input...

----------

ODBC Error Code = 37000 (Syntax error or access violation)

[Microsoft][ODBC Microsoft Access Driver] Invalid use of '.', '!', or '()'. in query expression 'Usercode = A.60203'.

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (27:1) to (27:57).

-----------

This should be easy stuff but I'm genuinely stumped.

Thanks,
Peter Edd
0
Comment
Question by:peteredd
3 Comments
 
LVL 6

Expert Comment

by:dash420
ID: 7112744
which version of access you are using?
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7113542
hi,

The error says
[Microsoft][ODBC Microsoft Access Driver] Invalid use of '.', '!', or '()'. in query expression 'Usercode = A.60203'.

Its giving u the errror for '.'

that means u've gotta enclose the value inside a single quote.

ie it should be UserCode='A.60203' [assuming usercode is a text field]

let me know if this helps

K'Rgds
Anand
0
 
LVL 1

Accepted Solution

by:
lpkuah earned 100 total points
ID: 7126482
Try this ->

<cfquery name="usercode_entry" datasource="#request.db#">
SELECT Usercode
FROM Codes
WHERE Usercode = '#preserveSingleQuotes(Trim(FORM.Usercode))#'
</cfquery>
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now