Forum Home
Press F1
 
Thread ID: 21062 2002-06-17 08:33:00 What's wrong with my SQL??? Guest (0) Press F1
Post ID Timestamp Content User
54808 2002-06-17 08:33:00 Hi,

I have the following line of SQL in one of my ASP pages...

Set CPUCost = Connect.Execute('SELECT [CPU.CPUCost] FROM CPU WHERE [CPU.CPUName]='&CPU('CPUName')&'')

The value of CPU('CPUName') is legitimate, no quote marks or anything dodgy that would usually force this kind of error.

The error it returns is:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '[CPU.CPUName]=AMD AthlonXP 1800'.

Huh?

What's wrong?

Thanks,

Erin
Guest (0)
54809 2002-06-17 09:06:00 Hi,

Apologies guys, I've solved it!

That's the second time I've done that this week! :)

Anyway, in case it may help someone later, the solution was to insert a single quote mark before [CPU... and after ...Name')'

Resulting in the following string:

('SELECT CPU.CPUCost FROM CPU WHERE 'CPU.CPUName='&CPU('CPUName')&''')

:)

Erin
Guest (0)
1