Gossamer Forum
Home : General : Internet Technologies :

Cold Fusion Error

Quote Reply
Cold Fusion Error
Hey There,

I am a new to cold fusion. I am trying to set up a search form. I have 3 fields by which the rows can be fetched from the sql server database.

Field1 Field2 Field3

I have set it up such that

<CFQUERY datasource="dsn" name="results">

SELECT * FROM vwname
WHERE
<CFIF '#Form.Field1#' IS NOT ""> AND column_name1 LIKE '%#Form.Field1#%' </cfif>
<CFIF '#Form.Field2#' IS NOT "">AND column_name2 LIKE '%#Form.Field2#%'</cfif>
<CFIF '#Form.Field3#' IS NOT "">AND column_name3 = '#Form.Field3#'</cfif>

</CFQUERY>

This is the error I get:

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



[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'AND'.

The error occurred while processing an element with a general identifier of (CFQUERY)

Can someone help me identify this problem?

Thanks in advance.

Gasa
Subject Author Views Date
Thread Cold Fusion Error gasa 6208 Jan 9, 2004, 7:11 AM
Post Re: [gasa] Cold Fusion Error
greykher 5966 Jan 9, 2004, 10:36 PM
Post Re: [gasa] Cold Fusion Error
Stealth 5967 Jan 9, 2004, 10:46 PM
Post Re: [gasa] Cold Fusion Error
gasa 5935 Jan 13, 2004, 10:05 AM