【问题标题】:Update Query not working in classic asp更新查询在经典 asp 中不起作用
【发布时间】:2021-05-06 12:59:12
【问题描述】:
update products set wcview = '1',ccview ='1' where pcprod_parentPrd = 33576 AND    pcprod_relationship like '%18493%'

当我在用于连接数据库的 sql 客户端中执行时,此 sql 查询有效

但是当我使用经典的 asp 代码时也是一样的,比如

relation =  Uid // This will give me 18439 
wcview and ccview is 1 // I have tested this

query1 = "update products set wcview = " & wcView &",ccview = " & ccView &" where pcprod_parentPrd = "& pIdProduct &" AND pcprod_relationship like '%"& relation &"%'"

当 where 子句中的 LIKE 过滤器仅返回 1 行时,相同的查询正在工作,因此它更新了一行,但当 Like 过滤器超过一行时,它不会从经典 asp 更新。

从客户端来说这不是问题

请帮忙..

【问题讨论】:

标签: sql asp-classic


【解决方案1】:

在您的 SQL 客户端查询中,您的插入值周围有单引号,而在您的 asp 版本中则没有

试试

query1 = "update products set wcview = '" & wcView &"',ccview = '" & ccView &"' where pcprod_parentPrd = "& pIdProduct &" AND pcprod_relationship like '%"& relation &"%'"

另外,在调试时,值得在执行查询的那一行之前输入Response.Write query1。当您使用带变量的 SQL 时,在经典 asp 中很容易出现语法错误

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-09
    • 2016-03-20
    相关资源
    最近更新 更多