在asp / sql中返回单个值 [英] return single value in asp/sql
问题描述
我假设这可以完成,但我似乎无法让它工作......我会想要从一个sql轻松返回一个值的
语句,如:
" intNewItems = conn.execute" SELECT COUNT(ItemID)WHERE ItemDate = Date()",
where conn是连接对象等等。我出错了什么?
你没有说出了什么问题。你得不到结果,10个结果,
错误的结果
" WC Justice" < WC ***** @ bellsouth.net>在消息中写道
新闻:10 ************* @ corp.supernews.com ...我假设这个可以做到,但我似乎无法让它工作......我想要从sql语句中轻松返回一个值,例如:
" intNewItems = conn.execute" SELECT COUNT(ItemID)WHERE ItemDate =
Date()",其中conn是连接对象等。我出错了什么?
对此感到抱歉。我已经复制了下面的实际代码和错误
<%
SET conn = server.createobject(" adodb.connection" ;)
conn.open" DSN =" &安培;会话(DSN)
intBrokerCount = conn.execute" SELECT COUNT(BrokerID)FROM tblBrokers"
response.write intBrokerCount &安培; "经纪人
%>
********************* ***************************** ********************* *****
Microsoft VBScript编译错误''800a0401''
预期声明结束
/sqltest.asp,第19行
intBrokerCount = conn.execute" SELECT COUNT(BrokerID)FROM tblBrokers"
---- -------------------------- ^
"用户设置" <太阳神******* @ entelifanio.net>在留言中写道
新闻:qZ ******************** @ comcast.com ...你没有说出了什么问题。你没有得到任何结果,10美元b $ b结果,错误的结果
WC Justice < WC ***** @ bellsouth.net>在消息中写道
新闻:10 ************* @ corp.supernews.com ...我假设这可以做到,但我似乎无法让它工作......我想要从sql语句中轻松返回一个值,就像
一样:
" intNewItems = conn.execute" SELECT COUNT(ItemID)WHERE ItemDate =
Date()",其中conn是连接对象等。我错了什么?
WC Justice于2004年8月12日在microsoft.public.inetserver.asp.general写道:< blockquote class =post_quotes> intBrokerCount = conn.execute" SELECT COUNT(BrokerID)FROM tblBrokers"
我会清除COUNT和(BrokerID)之间的空间
response.write intBrokerCount& "经纪人
我会写:
response.write intBrokerCount(0)& "经纪人
这会有帮助吗?
-
Evertjan。
荷兰。
(请将我的电子邮件地址中的x'变为点数)
I''m assuming this can be done, but I can''t seem to get it to work... I''d
like to easily return a single value from a sql statement, something like:
"intNewItems = conn.execute "SELECT COUNT (ItemID) WHERE ItemDate = Date()",
where conn is the connection object, etc. What am I getting wrong?
You didn''t say what is going wrong. Are you getting no results, 10 results,
wrong results
"WC Justice" <WC*****@bellsouth.net> wrote in message
news:10*************@corp.supernews.com...I''m assuming this can be done, but I can''t seem to get it to work... I''d
like to easily return a single value from a sql statement, something like:
"intNewItems = conn.execute "SELECT COUNT (ItemID) WHERE ItemDate = Date()", where conn is the connection object, etc. What am I getting wrong?
Sorry about that. I''ve copied the actual code and error below
<%
SET conn = server.createobject ("adodb.connection")
conn.open "DSN=" & Session("DSN")
intBrokerCount = conn.execute "SELECT COUNT (BrokerID) FROM tblBrokers"
response.write intBrokerCount & " Brokers"
%>
************************************************** **************************
Microsoft VBScript compilation error ''800a0401''
Expected end of statement
/sqltest.asp, line 19
intBrokerCount = conn.execute "SELECT COUNT (BrokerID) FROM tblBrokers"
------------------------------^
"User Settings" <Ra*******@entelifanio.net> wrote in message
news:qZ********************@comcast.com...You didn''t say what is going wrong. Are you getting no results, 10 results, wrong results
"WC Justice" <WC*****@bellsouth.net> wrote in message
news:10*************@corp.supernews.com...I''m assuming this can be done, but I can''t seem to get it to work... I''d
like to easily return a single value from a sql statement, something like:
"intNewItems = conn.execute "SELECT COUNT (ItemID) WHERE ItemDate =
Date()",where conn is the connection object, etc. What am I getting wrong?
WC Justice wrote on 12 aug 2004 in microsoft.public.inetserver.asp.general:intBrokerCount = conn.execute "SELECT COUNT (BrokerID) FROM tblBrokers"
I would clear the space between COUNT and (BrokerID)
response.write intBrokerCount & " Brokers"
I would write:
response.write intBrokerCount(0) & " Brokers"
Will this help?
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
这篇关于在asp / sql中返回单个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!