试图写更新回到SQL在ASP - 附近有语法错误'=' [英] Trying to write UPDATE back to SQL in ASP - Incorrect syntax near '='

查看:377
本文介绍了试图写更新回到SQL在ASP - 附近有语法错误'='的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点绿色的,当涉及到经典的ASP,所以我提前道歉。

I'm a bit green when it comes to Classic ASP, so I apologize in advance.

我在那得到与PC设备的详细信息填写表格的ASP页。这然后将其添加到SQL数据库。作品的魅力...

I have an asp page with a form that gets filled in with details of pc equipment. this then adds it to the SQL database. Works a charm...

不过,在视图页面,我们可以再更改任何一个细节,当我点击保存修改按钮,我得到一个错误。

However, on the view page where we can then change any of the details, when I click the "save changes" button I get an error.

附近有语法错误'='

下面是我:

<!-- #include file="Tauthenticate.asp" -->

<!--#include file="database.asp"-->

<%

pcname=request.form("T1")
pctype=request.form("T2")
pccpu=request.form("T3")
pcram=request.form("T4")
pcmake=request.form("T5")
pcmodel=request.form("T5b")
pcdate=request.form("T6")
graphics=request.form("T7")
notes=request.form("T8")
tag=request.form("T9")
cd_dvd=request.form("T10")


sqlq = "UPDATE PC set PC_Name='" & pcname & "', Type='" & pctype & "', CPU='" & pccpu & "', RAM='" & pcram & "', Make='" & pcmake & "', Model='" & pcmodel & "', Date='" & pcdate & "', Graphics='" & graphics & "', Notes='" & notes & "', Service_Tag='" & tag & "', CD_DVD='" & cd_dvd & "' where PC_ID=" & pcid
response.write(sqlq)
conn.execute(sqlq)
Response.Redirect("../PCs/PCView.asp?pc=" & pcid)



%>

快速测试后,我得到这样的结果。

After a quick test, i get this result

更新PC设置PC_Name ='LRW9999',类型='台式电脑',CPU =等等等等,RAM ='5555',使=等等等等,型号='斗斗',日期= '09 / 02/16',图形=等等等等,说明='只测试,Service_Tag ='gyudsgysdgsgghfs',CD_DVD ='9999',其中PC_ID =

UPDATE PC set PC_Name='LRW9999', Type='Desktop PC', CPU='blah blah', RAM='5555', Make='blah blah', Model='doo doo', Date='09/02/16', Graphics='blah blah', Notes='test only', Service_Tag='gyudsgysdgsgghfs', CD_DVD='9999' where PC_ID=

Microsoft OLE DB提供了SQL Server错误80040E14

Microsoft OLE DB Provider for SQL Server error '80040e14'

附近有语法错误'='。

Incorrect syntax near '='.

/PCs/SaveChangesnew.asp 28行

/PCs/SaveChangesnew.asp, line 28

我在哪里去了?看来我不能看到树不见林,我需要新鲜的眼光来帮我。

Where am I going wrong? It seems I can't see the wood for the trees and I need fresh eyes to help me.

推荐答案

更新您的SQLQuery到以下几点:

Update your sqlquery to following:

sqlq = "UPDATE PC set PC_Name='" & pcname & "', Type='" & pctype & "', CPU='" & pccpu & "', RAM='" & pcram & "', Make='" & pcmake & "', Model='" & pcmodel & "', Date='" & pcdate & "', Graphics='" & graphics & "', Notes='" & notes & "', Service_Tag='" & tag & "', CD_DVD='" & cd_dvd & "' where PC_ID='" & pcid &"'"

这篇关于试图写更新回到SQL在ASP - 附近有语法错误'='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆