select id,p_code,product,p_product,p_width,p_width_fb,p_length,p_length_fb,p_muwen,printno,p_account,
( select count(id) from VIEW_product_code AS b where b.p_id in ('780361','780540','780539','780366') and b.product=a.product and b.p_width=a.p_width and b.p_length=a.p_length and b.p_muwen=a.p_muwen ) AS sumshu
from VIEW_product_code AS a where p_id in ('780361','780540','780539','780366')
order by replace(left(product,patindex('%[^a-zA-Z0-9]%',product)-1),'TB',''),case when product = '标准件' then 0 when left(product,2) = 'TB' then 1 else 2 end, p_width desc,p_length desc,p_muwen,id,p_code
看看这SQL错在哪里呢?
怎么在网页程序运行时没有找到记录,而在查询分析器中运行却有记录的?
要怎么修改才能在ASP网页程序中正常查询到数据记录呢?
( select count(id) from VIEW_product_code AS b where b.p_id in ('780361','780540','780539','780366') and b.product=a.product and b.p_width=a.p_width and b.p_length=a.p_length and b.p_muwen=a.p_muwen ) AS sumshu
from VIEW_product_code AS a where p_id in ('780361','780540','780539','780366')
order by replace(left(product,patindex('%[^a-zA-Z0-9]%',product)-1),'TB',''),case when product = '标准件' then 0 when left(product,2) = 'TB' then 1 else 2 end, p_width desc,p_length desc,p_muwen,id,p_code
看看这SQL错在哪里呢?
怎么在网页程序运行时没有找到记录,而在查询分析器中运行却有记录的?
要怎么修改才能在ASP网页程序中正常查询到数据记录呢?
( select count(id) from VIEW_product_code AS b where b.p_id in ('780361','780540','780539','780366') and b.product=a.product and b.p_width=a.p_width and b.p_length=a.p_length and b.p_muwen=a.p_muwen ) AS sumshu
from VIEW_product_code AS a where p_id in ('780361','780540','780539','780366') 测试过了,这样在网页程序中也不行,而在SQL查询分析器是可以的.
网页程序是没有问题的,就是上面这个SQL在网页中不能正常运行的.没有提示出错,而是查询不到记录。
后,
变成下面的:
select id,p_code,product,p_product,p_width,p_width_fb,p_length,p_length_fb,p_muwen,printno,p_account
from VIEW_product_code AS a where p_id in ('780361','780540','780539','780366')
可以在ASP中执行了,可是这样不能计算sumshu了。所以问题是出在下面语句:
, ( select count(id) from VIEW_product_code AS b where b.p_id in ('780361','780540','780539','780366') and b.product=a.product and b.p_width=a.p_width and b.p_length=a.p_length and b.p_muwen=a.p_muwen ) AS sumshu
这是什么问题呢?该如何修正呢?
在网页程序打开数据库查找不到记录呢?这个部分语句如何修改呢?