Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design


Topic Tools
Old January 27th, 2005, 05:20 PM
Opacus Opacus is offline
New Member
Join Date: Jan 2005
Posts: 1
Getting Odd SQL Error message

Ok, so I have no idea why a certain web page is giving up this error:

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

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

/iframe-searchwarranty.asp, line 157

When I look at the ASP code it looks like this:

<% 'on error resume next
sql= "select warrantynumber, custname, custCity, custState, date_warranty_request_doc, Date_installation_doc, date_rgn_doc from warranty_doc where"
'use j variable to select if put an "AND"
'use k variable to select if the statement will show or not
For each item in request.form

if (len(Trim(Request.Form(item)))>0 and item<>"Submit22") then
fieldnameValue=replace(Request.Form(item),"'","''" )
if j=1 then
sql = sql &" AND "
end if
sql=sql & fieldname &" LIKE '"&trim(fieldnamevalue)&"%' "
end if
sql = sql & " order by warrantynumber DESC, custName ASC"

When I parse the SQL in QueryAnalyzer it is all happy and fun. PLEASE tell me what I am doing wrong... I have been trying to work this out for hours now and there is very little in the way of help on that particular error...

I am ever so grateful for you even reading my post, have a great day.
Reply With Quote

Old January 30th, 2005, 08:25 PM
Steven.Bentley Steven.Bentley is offline
CTH Subscriber
Join Date: Nov 2000
Location: West Yorkshire, UK
Age: 43
Posts: 3,840
I'd echo (or the ASP equivalent) out the sql variable, see what the full query is and see whether that looks right
Reply With Quote


Topic Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 06:26 AM.