如何根据短路顺序在网格视图中显示数据 [英] How to display data in grid view based on shorting order
本文介绍了如何根据短路顺序在网格视图中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经编写了直接从存储过程中检索数据的数据集。
OUTPUT--执行存储过程输出后就是这样。
Hi,
I have have written dataset for retrieving data directly from stored procedure .
OUTPUT-- After executing Stored procedure output is coming like this.
3RD PARTY SUPPLIER 422 60 40
CONTRACTOR 808 43 57
EQUIPMENT SERVICE 260 85 15
我在网格视图中以与上面输出相同的格式显示前端。但在网格视图中我需要显示以下订单数据 -
I am displaying in fronted in same format as above output in grid view. but in grid view i need to display data this below order-
CONTRACTOR 808 43 57
3RD PARTY SUPPLIER 422 60 40
EQUIPMENT SERVICE 260 85 15
这是SP -----
This is the SP-----
declare @Total as table (SC_SupplierCategoryName Nvarchar(100),PG_TotalAntExend int,PG_PercMadeinOmanTotal int)
insert into @Total(SC_SupplierCategoryName,PG_TotalAntExend,PG_PercMadeinOmanTotal)
select 'CONTRACTOR', SUM(PG_TotalAntExend)as total1, SUM(PG_TotalAntExend*PG_PercMadeinOman)/SUM(PG_TotalAntExend) as PG_PercMadeinOmanTotal
from TR_ICV_PlanningGoods
where SC_SupplierCategoryID in (1,4) and ICV_ID in(select ICV_ID from TM_ICV where icv_supplier_contractID=@ContractNumber)
group by SC_SupplierCategoryID
--declare @Total as table (SC_SupplierCategoryName Nvarchar(100),PG_TotalAntExend int,PG_PercMadeinOmanTotal int)
insert into @Total(SC_SupplierCategoryName,PG_TotalAntExend,PG_PercMadeinOmanTotal)
select '3RD PARTY SUPPLIER', SUM(PG_TotalAntExend)as total1, SUM(PG_TotalAntExend*PG_PercMadeinOman)/SUM(PG_TotalAntExend) as PG_PercMadeinOmanTotal
from TR_ICV_PlanningGoods
where SC_SupplierCategoryID in (2,5) and ICV_ID in(select ICV_ID from TM_ICV where icv_supplier_contractID=@ContractNumber)
group by SC_SupplierCategoryID
insert into @Total(SC_SupplierCategoryName,PG_TotalAntExend,PG_PercMadeinOmanTotal)
select 'EQUIPMENT SERVICE', SUM(PG_TotalAntExend)as total1, SUM(PG_TotalAntExend*PG_PercMadeinOman)/SUM(PG_TotalAntExend) as PG_PercMadeinOmanTotal
from TR_ICV_PlanningGoods
where SC_SupplierCategoryID in (3) and ICV_ID in(select ICV_ID from TM_ICV where icv_supplier_contractID=@ContractNumber)
group by SC_SupplierCategoryID
--select * from @Total
select SC_SupplierCategoryName , sum(PG_TotalAntExend) as Total_Expenditure,
(sum(PG_TotalAntExend*PG_PercMadeinOmanTotal)/sum(PG_TotalAntExend)) as Made_in_Oman,
100 - (sum(PG_TotalAntExend*PG_PercMadeinOmanTotal)/sum(PG_TotalAntExend)) as Not_Made_In_Oman
from @Total group by SC_SupplierCategoryName
推荐答案
在存储过程中的最终查询中包含SC_SupplierCategoryName的顺序。您还可以根据您使用的内容使用DataTable和DataView中提供的Sort选项。
http://stackoverflow.com/questions/11029823/dataset-sorting [ ^ ]
Include order by SC_SupplierCategoryName in your final query in stored proc. You can also use Sort option provided in DataTable and DataView depending on what you are using.
http://stackoverflow.com/questions/11029823/dataset-sorting[^]
参考
如何在ASP.NET中的Gridview中执行排序 [ ^ ]
//change below
group by SC_SupplierCategoryName to group by SC_SupplierCategoryName order by SC_SupplierCategoryName
它将解决你的问题。试试看是否有帮助
it will solve your problem. Let try it and reply if it helps or not
这篇关于如何根据短路顺序在网格视图中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文