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更新。
从客户端来看,这不是问题
请帮助..
答案 0 :(得分:0)
在SQL客户端查询中,您的插入值周围有单引号,在您的asp版本中没有
尝试
query1 = "update products set wcview = '" & wcView &"',ccview = '" & ccView &"' where pcprod_parentPrd = "& pIdProduct &" AND pcprod_relationship like '%"& relation &"%'"
此外,当您进行调试时,值得在执行查询的行之前放入Response.Write query1
。在使用带变量的SQL