Click to See Complete Forum and Search --> : Syntax error in query. Incomplete query clause.


GDawgGWC
04-28-2006, 01:34 PM
I have created a page that manages permissions for users, letting them access, or not access, certain pages within the site depending on the permissions. I tried to adapt this page into a self-customization page in which users can block their own access to pages that they just don't want to have muddling up their interface. The original page works perfectly, however, in removing a few of the fields for this seperate page, it throws the following error:

Microsoft JET Database Engine error '80040e14'
Syntax error in query. Incomplete query clause.
/Pages/customize.asp, line 177

The code which is updating the database is here:

sql="UPDATE security SET "
sql=sql & "home="
if Request.Form("home")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",engineering="
if Request.Form("engineering")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",drafting="
if Request.Form("drafting")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",charts="
if Request.Form("charts")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",office="
if Request.Form("office")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",catalogs="
if Request.Form("catalogs")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",bddl="
if Request.Form("bddl")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",trussstatus="
if Request.Form("trussstatus")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",key_dtl="
if Request.Form("keyanddtl")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",sw_hd="
if Request.Form("sw_hd")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",sheetindex="
if Request.Form("sheetindex")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",porch="
if Request.Form("porch")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",draftdeskref="
if Request.Form("draftingdeskref")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",repro="
if Request.Form("repro")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",draftstand="
if Request.Form("draftstandard")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",adtinfo="
if Request.Form("adtinfo")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",strip="
if Request.Form("strip")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",specialchars="
if Request.Form("specialchars")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & ",plot_pub="
if Request.Form("plotandpub")<>"" Then sql=sql & "True" Else sql=sql & "False" End If
sql=sql & " WHERE user='" & xuser & "'"
adoCon.Execute sql '**LINE 177**

if I replace the execute line with a response.write(sql) the statement looks fine to me...

UPDATE security SET home=True,engineering=True,drafting=True,charts=True,office=True,catalogs=True,bddl=True,trussstatus =True,key_dtl=True,sw_hd=True,sheetindex=True,porch=True,draftdeskref=True,repro=True,draftstand=Tru e,adtinfo=True,strip=True,specialchars=True,plot_pub=True WHERE user='Gcronin'

Thanks in advance!
-Greg

lmf232s
04-28-2006, 01:43 PM
well in the query provided i see this

draftstand=Tru e,

which should through an error if say the data type is bit.

Aslo take you statement and execute it query analyser (if you use sql server 2000) and this will provide an error that might be more helpful

GDawgGWC
04-28-2006, 01:51 PM
Thanks for that. The space in "Tru e" doesn't show up on the page, must've been an accidental space in the post. As far as the database, it's MSAccess, and I don't have much access to the server as it's a remote web host.

GDawgGWC
04-28-2006, 01:55 PM
Whoops. Second time I've done this, the page was cached, when I Ctrl-Refreshed it, it came up fine. Sorry for the trouble.