经典的ASP - 奇怪的问题。 [英] Classic ASP - strange problem.

查看:51
本文介绍了经典的ASP - 奇怪的问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个简单的少于条件语句,如果我使用数据库元素,则点击

砖墙。


这项工作:

< ;%

如果Request.QueryString(" PC")< 10然后Response.Write(小于10)否则

Response.Write(大于或等于10)结束如果

%>

这不起作用:

<%

如果Request.QueryString(" PC")< Record.Fields.Item(" count(*)")。值然后

Response.Write("小于COU​​NT")否则Response.Write("小于或等于

count")结束如果

%>


唯一的区别是在第一个例子中,一个数字被用作

条件。在第二个例子中,我已经计算了

表中的行数,我想用这个数字作为条件。 SQL select是:

SELECT count(*),EnquiryDate

FROM lfmasterleads.partner_enquiries

WHERE EnquiryDate = CURRENT_DATE()GROUP BY EnquiryDate


非常感谢任何帮助!


Darren。

解决方案

为什么不使用类似的东西;


<%

Dim valCount

valCount = Record.Fields.Item(" count(*)")。值


如果Request.QueryString(" PC")< valCount然后

Response.Write(小于COU​​NT)

否则

Response.Write(小于或等于count ;)

结束如果

%>


这样,您将值粘贴到变量中,而不是加载它
动态
(如果有意义的话?)


-

问候


Steven Burn

Ur IT Mate Group
www.it-mate.co.uk


保持免费!


免责声明:

我知道我可能错了,我只是喜欢服用部分; o)

加里< so *** @ nocando.com>在消息中写道

新闻:Bh ******************* @ news-text.cableinet.net ...

我正在尝试做一个简单的少于条件语句,如果我使用数据库元素,则点击
a砖墙。

这个DOES工作:
<%
如果Request.QueryString(") PC)< 10然后Response.Write(小于10)
else Response.Write(大于或等于10)结束如果
%>

这不工作:
<%
如果Request.QueryString(" PC")< Record.Fields.Item(" count(*)")。值然后
Response.Write(小于COU​​NT)否则Response.Write("小于或等于
来计算) ;)结束如果
%>

唯一的区别是在第一个例子中,一个数字被用作
条件。在第二个例子中,我已经计算了
表中的行数,并且我想使用该数字作为条件。 SQL选择是:
SELECT count(*),EnquiryDate
FROM lfmasterleads.partner_enquiries
WHERE EnquiryDate = CURRENT_DATE()GROUP BY EnquiryDate

任何帮助非常感谢!

Darren。



Gary于2004年2月16日在microsoft.public.inetserver.asp.general写道:

我正在尝试做一个简单的小于条件语句,如果我使用数据库元素,就会碰到一堵砖墙。

如果Request.QueryString("),那么这个工作:
<%
; PC")< 10然后Response.Write(小于10)
否则Response.Write(大于或等于10)结束如果
%>

这不工作:
<%
如果Request.QueryString(" PC")< Record.Fields.Item(" count(*)")。值
然后Response.Write(小于COU​​NT)否则Response.Write(小于
或等于count ;)结束如果
%>




将字符串与数字进行比较,将最合适的数字转换为数字是

尝试


比较两个字符串,没有尝试和比较是

aphanumeric。


< script language = vbs>


''准备IE vbs伪ASP测试环境

设置响应=文件


Response.Write(17> 6)& "<峰; br>" &安培; vbCrLf

Response.Write(" 17">" 6")& "<峰; br>" &安培; vbCrLf


< / script>


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)


" Gary" <所以*** @ nocando.com>在消息中写道

新闻:Bh ******************* @ news-text.cableinet.net ...

我正在尝试做一个简单的少于条件语句,如果我使用数据库元素,则点击
a砖墙。

这个DOES工作:
<%
如果Request.QueryString(") PC)< 10然后Response.Write(小于10)
else Response.Write(大于或等于10)结束如果
%>

这不工作:
<%
如果Request.QueryString(" PC")< Record.Fields.Item(" count(*)")。值然后
Response.Write(小于COU​​NT)否则Response.Write("小于或等于
来计算) ;)结束如果
%>

唯一的区别是在第一个例子中,一个数字被用作
条件。在第二个例子中,我已经计算了
表中的行数,并且我想使用该数字作为条件。 SQL选择是:
SELECT count(*),EnquiryDate
FROM lfmasterleads.partner_enquiries
WHERE EnquiryDate = CURRENT_DATE()GROUP BY EnquiryDate

任何帮助非常感谢!

Darren。




确保比较为数字


lCount = Record.Fields( 0).value


if val(Request.QueryString(" PC")))< lCount然后......


-

John Blessing

http://www.LbeHelpdesk.com - 价格适合所有

商家的服务台软件
http://www.free-helpdesk.com - 完全免费的帮助台软件! http://www.lbetoolbox.com - 从MS Outlook中删除重复项


I am trying to do a simple "less than" conditional statement, and hitting a
brick wall if I use a database element with it.

This DOES work:
<%
if Request.QueryString("PC") < 10 then Response.Write("less than ten") else
Response.Write("more than or equal to ten") End if
%>
This DOES NOT work:
<%
if Request.QueryString("PC") < Record.Fields.Item("count(*)").Value then
Response.Write("less than COUNT") else Response.Write("less than or equal to
count") End if
%>

The only difference is that in the first example a number is used as the
condition. in the second example, I have counted the number of rows in a
table, and I want to use that number as the condition. The SQL select is:
SELECT count(*), EnquiryDate
FROM lfmasterleads.partner_enquiries
WHERE EnquiryDate = CURRENT_DATE() GROUP BY EnquiryDate

Any help greatly appreciated!

Darren.

解决方案

Why not use something like;

<%
Dim valCount
valCount = Record.Fields.Item("count(*)").Value

If Request.QueryString("PC") < valCount Then
Response.Write("less than COUNT")
Else
Response.Write("less than or equal to count")
End if
%>

This way, your sticking the value into a variable, rather than loading it
dynamically (if that makes sense?)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I''m probably wrong, I just like taking part ;o)
Gary <so***@nocando.com> wrote in message
news:Bh*******************@news-text.cableinet.net...

I am trying to do a simple "less than" conditional statement, and hitting a brick wall if I use a database element with it.

This DOES work:
<%
if Request.QueryString("PC") < 10 then Response.Write("less than ten") else Response.Write("more than or equal to ten") End if
%>
This DOES NOT work:
<%
if Request.QueryString("PC") < Record.Fields.Item("count(*)").Value then
Response.Write("less than COUNT") else Response.Write("less than or equal to count") End if
%>

The only difference is that in the first example a number is used as the
condition. in the second example, I have counted the number of rows in a
table, and I want to use that number as the condition. The SQL select is:
SELECT count(*), EnquiryDate
FROM lfmasterleads.partner_enquiries
WHERE EnquiryDate = CURRENT_DATE() GROUP BY EnquiryDate

Any help greatly appreciated!

Darren.



Gary wrote on 16 feb 2004 in microsoft.public.inetserver.asp.general:

I am trying to do a simple "less than" conditional statement, and
hitting a brick wall if I use a database element with it.

This DOES work:
<%
if Request.QueryString("PC") < 10 then Response.Write("less than ten")
else Response.Write("more than or equal to ten") End if
%>
This DOES NOT work:
<%
if Request.QueryString("PC") < Record.Fields.Item("count(*)").Value
then Response.Write("less than COUNT") else Response.Write("less than
or equal to count") End if
%>



comparing a string to a number, a conversion of the fitst to a number is
attempted

comparing two strings, no atempt is made and the comparison is
aphanumeric.

<script language=vbs>

'' prepare IE vbs pseudo ASP test environment
set response = document

Response.Write ("17" > 6) & "<br>" & vbCrLf
Response.Write ("17" > "6") & "<br>" & vbCrLf

</script>

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


"Gary" <so***@nocando.com> wrote in message
news:Bh*******************@news-text.cableinet.net...

I am trying to do a simple "less than" conditional statement, and hitting a brick wall if I use a database element with it.

This DOES work:
<%
if Request.QueryString("PC") < 10 then Response.Write("less than ten") else Response.Write("more than or equal to ten") End if
%>
This DOES NOT work:
<%
if Request.QueryString("PC") < Record.Fields.Item("count(*)").Value then
Response.Write("less than COUNT") else Response.Write("less than or equal to count") End if
%>

The only difference is that in the first example a number is used as the
condition. in the second example, I have counted the number of rows in a
table, and I want to use that number as the condition. The SQL select is:
SELECT count(*), EnquiryDate
FROM lfmasterleads.partner_enquiries
WHERE EnquiryDate = CURRENT_DATE() GROUP BY EnquiryDate

Any help greatly appreciated!

Darren.



Make sure the comparison is numeric

lCount = Record.Fields(0).value

if val (Request.QueryString("PC") ) < lCount then ...

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.free-helpdesk.com - Completely free help desk software !
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook


这篇关于经典的ASP - 奇怪的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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