【发布时间】:2018-06-17 04:33:46
【问题描述】:
我在 SQL Server 2008 中使用这条 SQL 语句进行查询:
select
sum(tax + debit) + (select isnull(sum(tax + credit), 0)
from BILLTRANSACTION
where (BillClass = 2 or BillClass = 5 or BillClass = 6)
and (ClientID = 101383)
and datediff(month, StatementOrRecptDate, '3-31-2018') >= 0
and datediff(month, BeginDate, '3-31-2018') = 1)
from
BILLTRANSACTION
where
(ClientID = 101383)
and datediff(month, EndDate, '3-31-2018') = 1
它有效 - 现在我正在尝试将它应用到我在 vb.net 中的代码,但它不起作用。
顺便说一句,我有一个本地 SQL Server Compact 数据库,我针对它运行查询,但它不起作用。
这是我的错误截图:https://ibb.co/fKBkHy
【问题讨论】:
-
如果您 a) 显示您的 VB.NET 代码可能会有所帮助,因为错误可能就在其中,并且 b) 指定“不工作”,例如发布错误消息或描述与预期不同的意外行为。
-
您好,请发布您的代码和您收到的错误代码
-
SQL Server 精简版supports only a subset of SQL Server T-SQL grammar。我怀疑
SELECT子句中的子查询是问题所在。
标签: sql sql-server vb.net sql-server-ce