帮助sql在asp if语句中的语句 [英] help with sql where in statement within asp if statement

查看:58
本文介绍了帮助sql在asp if语句中的语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用经典的asp和sql server。我的if语句检查是否有5个地方的价格[price_band_1到5]然后如果有任何值shoud输出''我有数据''但它没有..任何人都可以帮忙吗?


i没有得到任何错误,但在页面上输出我没有数据。如果你从sql server查看我的示例数据,这显然是错误的

im using classic asp and sql server. my if statement checks if there is a price within 5 places [price_band_1 to 5] and then if any has a value shoud output ''I HAVE DATA'' but it doesnt.. can anyone help?

i dont get any errors but Instead ''I HAVE NO DATA'' is output on the page. this is clearly wrong if you look at my sample data from sql server

展开 | 选择 | Wrap | 行号

推荐答案

只是一个小技巧,在您的查询中创建一个新的字段,即价格区间的总和。然后当你检查你只需要检查一个字段而不是这个字段或这个字段或这个字段......
Just a little trick, make a new field in your query that is the sum of the price bands. Then when you check you just have to check one field instead of this field or this field or this field...
< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


col1 + col2 +在sql查询中究竟做了什么?它合并两列还是意味着col1加col2?所以例如如果col1中有10个而col2有10个那么它保留20作为objRS(priceum)??我是对的吗?


尝试了你的建议
what exactly does the col1+col2+ do within the sql query? does it merge both columns or does it mean col1 plus col2? so for example if col1 had 10 within it and col2 had 10 then it retains 20 as objRS("pricesum")?? am i right?

have tried your suggestion as
展开 | 选择 | Wrap | 行号


它给出你要检查一个列,而不是检查col1> 0或col2> 0或col3> 0.


我认为我们把它放在支柱后面 - 它应该说是objRS(priceum)> 0


接下来尝试打印出该值以查看它是否以数学方式添加或连接。


Jared
It gives you a single column to check instead of checking if col1 > 0 or col2 > 0 or col3 > 0.

I think we put that less than bracket backwards - it should say if objRS("pricesum") > 0

Next try printing out that value to see if it is mathematically added or concatenated.

Jared


这篇关于帮助sql在asp if语句中的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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