Allen 2010-12-14 09:41:47 11771 1 0 0 0

刚才整理了一下友情链接页面,添加了管理密码。无意中发现修改页面不能正常保存,报错如下:

Microsoft JET Database Engine 错误 '80040e14

UPDATE 语句的语法错误

……

检查代码中sql语句,没有问题啊。

pSql="update Resource set User_ID ='" & pUserID & "', Status='" & pStatus & "',SortI='" & pSortI & "',SortII='" & pSortII & "', Name='" & pName & "', Address='" & pAddress & "',Image='" & pImage & "',Width='" & pWidth & "',Height='" & pHeight & "',Owner='" & pOwner & "',Author1='" & pAuthor1 & "',Author2='" & pAuthor2 & "',Author3='" & pAuthor3 & "',Email='" & pEmail & "',Homepage='" & pHomepage & "',Special='" & pSpecial & "',Description='" & pDescription & "',Recommend='" & pRecommend & "',Remark='" & pRemark & "',UpdataUser='" & pUser & "', UpdataDate='" & pDateTime & "' where ID=" & pID

又将SQL语句在网页中显示,复制到数据库中执行,没有问题。

update Resource set User_ID ='TAL', Status='A',SortI='网站',SortII='IT', Name='秀客网', Address='http://www.picook.com/',Image='http://picook.com/Picook.asp?pID=2362',Width='',Height='',Owner='',Author1='',Author2='',Author3='',Email='ssssssss',Homepage='http://www.picook.com/',Remark='',UpdataUser='00000', UpdataDate='20101214094733' where ID=166

真是奇怪,偏偏还没有别的提示,只是说语法错误……

在网上搜了一下,终于找到解决办法:

Microsoft JET Database Engine 错误 '80040e14' UPDATE 语句的语法错误。 

有代码如: 

Update 表 set action="值" where id=值 

发现在action用作字段有问题,不知是否与关键字冲突,改为: 

Update 表 set [action]="值" where id=值 

问题解决!

按此方法,将sql中的字段加上方括号:

pSql="update Resource set [User_ID] ='" & pUserID & "', [Status]='" & pStatus & "',[SortI]='" & pSortI & "',[SortII]='" & pSortII & "', [Name]='" & pName & "', [Address]='" & pAddress & "',[Image]='" & pImage & "',[Width]='" & pWidth & "',[Height]='" & pHeight & "',[Owner]='" & pOwner & "',[Author1]='" & pAuthor1 & "',[Author2]='" & pAuthor2 & "',[Author3]='" & pAuthor3 & "',[Email]='" & pEmail & "',[Homepage]='" & pHomepage & "',[Special]='" & pSpecial & "',[Description]='" & pDescription & "',[Recommend]='" & pRecommend & "',[Remark]='" & pRemark & "',[UpdataUser]='" & pUser & "', [UpdataDate]='" & pDateTime & "' where [ID]=" & pID

果然,问题解决了!

其实在access中用查询视图生成的sql请语句中的字段都是带方括号的,但有时手写不带也可以,所以一般时候都不带,没想到这次碰到问题了!


【版權聲明】
本文爲原創,遵循CC 4.0 BY-SA版權協議!轉載時請附上原文鏈接及本聲明。
原文鏈接:https://tdlib.com/am.php?t=XuPXezK8yVHw
Tag: ASP知识 网页编程 TTTBLOG
我也要發一個   ·   返回首頁   ·   返回[Html]   ·   前一個   ·   下一個
評論
Allen#1Allen 2011-09-24 08:04:37(N) 鏈接地址
| 1755 | ww.ytzx.net | 2011-09-24 08:04:37 | [email protected] | http://ww.ytzx.net |
-----
好复杂的sql语句[REVERT=tao 于 2011-10-18 14:33:39 回复]呵呵,其实并不复杂了,就是一个更新语句,可能更新的字段多了些,而且是用代码合成的,所以显得挺乱的。[/REVERT]
頂部     1/1 
歡迎評論
未登錄,
請先 [ 註冊 ] or [ 登錄 ]
(一分鍾即可完成註冊!)
返回首頁     ·   返回[Html]   ·   返回頂部