不支持 DataSet TableAdapter 抛出 OVER SQL 构造或语句 [英] DataSet TableAdapter throwing OVER SQL construct or statement not supported

查看:15
本文介绍了不支持 DataSet TableAdapter 抛出 OVER SQL 构造或语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用此示例帮助编写的 t-sql 查询.

I have a t-sql query written with this sample help.

SELECT  t.gName AS 'Product'
, isnull(SUM(CASE WHEN t.Col = 1 THEN t.Quantity END),0) AS '180ml'
, isnull(SUM(CASE WHEN t.Col = 2 THEN t.Quantity END),0) AS '375ml'
, isnull(SUM(CASE WHEN t.Col = 3 THEN t.Quantity END),0) AS '500ml'
, isnull(SUM(CASE WHEN t.Col = 4 THEN t.Quantity END),0) AS '1000ml'
, isnull(SUM(CASE WHEN t.Col = 5 THEN t.Quantity END),0) AS '2000ml'
FROM (
SELECT p.pName
     , p.pCode
     , p.pGroup
     , p.pSize, i.gName, i.gCode
     , sl.Quantity, sl.BillDate
     , DENSE_RANK() OVER(PARTITION BY p.pGroup ORDER BY p.pSize) AS Col 
    FROM 
        ItemGroup AS i INNER JOIN 
                          Products AS p ON i.gCode = p.pGroup INNER JOIN 
                          SalesLog AS sl ON p.pGroup = sl.pGroup
       AND p.pCode = sl.ProductCode   
       ) AS t where t.BillDate=@BillDate and t.pGroup!=15 and t.pGroup!=16
     GROUP BY t.gName
    order by t.gName

它在 Management Studio 查询编辑器中工作,但不在 DataSet 中引发错误,例如 不支持 OVER SQL 构造或语句.

Its working in Management Studio Query Editor but not in DataSet throwing error like The OVER SQL construct or statement not supported.

这是报告 (.rdlc) 所需的查询.请帮忙

this is query needed for for Report (.rdlc). Please help

谢谢

推荐答案

我会将此 SQL 放入存储过程或视图中.然后您可以从那里填充您的数据集.

I would put this SQL in to a Stored Procedure or a View. You can then populate your DataSet from there.

这篇关于不支持 DataSet TableAdapter 抛出 OVER SQL 构造或语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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