将多个细胞合并为一个细胞

发布于 2024-10-26 15:28:04 字数 1266 浏览 1 评论 0原文

我正在使用 linq 查询来获取客户表,其中每个货币单位的总金额存在于我的数据库中(这个没问题。) 当使用 Microsoft Report Viewer 显示我的查询结果时,结果类似于表 1,但我想要的是表 2,只有客户名称(如“A”)和包含所有货币单位记录的单元格 > 0.

您有什么建议吗?

这是我的代码,它生成表 1:

var query = from kur in kurToplamlist                        
                    join cariBilg in db.TBLP1CARIs
                                  on kur.CariIdGetSet equals cariBilg.ID
                    select new
                    {
                        cariBilg.ID,//customerid
                        EUROBAKIYE = cariBilg.HESAPADI,
                        cariBilg.K_FIRMAADI,//other column names
                        cariBilg.K_YETKILIADI,//other column names
                        cariBilg.K_FIRMATELEFON,//other column names
                        cariBilg.K_YETKILITELEFON,//other column names
                        AUDBAKIYE = cariBilg.B_CEPTELEFON,//other column names                            
                        MonetaryUnit = String.Concat(kur.KurToplamMiktarGetSet.ToString(), kur.DovizTuruGetSet.ToString()),//concatenates "100" and "TL/USD etc."                          

                    };

我想要的是获得图像中的表 2 先感谢您。

表格图片

I am using a linq query to obtain a table of customers with their total money amount for each monetary unit exist in my database(this one is ok.)
when show the result of my query with Microsoft Report Viewer the result is like Table 1 but what i want is Table 2, only the customer name like "A" and a cell with all the monetory unit records > 0.

Is there any way you can suggest?

This is my code which produces Table 1:

var query = from kur in kurToplamlist                        
                    join cariBilg in db.TBLP1CARIs
                                  on kur.CariIdGetSet equals cariBilg.ID
                    select new
                    {
                        cariBilg.ID,//customerid
                        EUROBAKIYE = cariBilg.HESAPADI,
                        cariBilg.K_FIRMAADI,//other column names
                        cariBilg.K_YETKILIADI,//other column names
                        cariBilg.K_FIRMATELEFON,//other column names
                        cariBilg.K_YETKILITELEFON,//other column names
                        AUDBAKIYE = cariBilg.B_CEPTELEFON,//other column names                            
                        MonetaryUnit = String.Concat(kur.KurToplamMiktarGetSet.ToString(), kur.DovizTuruGetSet.ToString()),//concatenates "100" and "TL/USD etc."                          

                    };

What i want is to obtain Table 2 in the image
Thank you in advance.

Table image

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不即不离 2024-11-02 15:28:05
var query = from kur in kurToplamlist
                    where kur.KurToplamMiktarGetSet > 0
                    join cariBilg in db.TBLP1CARIs
                                  on kur.CariIdGetSet equals cariBilg.ID
                    select new
                    {
                        cariBilg.ID,
                        EUROBAKIYE = cariBilg.HESAPADI,
                        cariBilg.K_FIRMAADI,
                        cariBilg.K_YETKILIADI,
                        cariBilg.K_FIRMATELEFON,
                        cariBilg.K_YETKILITELEFON,
                        AUDBAKIYE = cariBilg.B_CEPTELEFON,
                        TLBAKIYE = String.Concat(kur.KurToplamMiktarGetSet.ToString(), kur.DovizTuruGetSet.ToString()),   


                    };
        var dfg = from qre in query
                  select qre.TLBAKIYE;

        var aq = (from qw in query
                  select new { 
                        qw.ID,
                        EUROBAKIYE = qw.EUROBAKIYE,
                        qw.K_FIRMAADI,
                        qw.K_YETKILIADI,
                        qw.K_FIRMATELEFON,
                        qw.K_YETKILITELEFON,
                        AUDBAKIYE = qw.AUDBAKIYE,
                        TLBAKIYE = String.Join(",", (from qre in query
                                                    where qre.ID == qw.ID
                                                    select qre.TLBAKIYE).Distinct())

                 }).Distinct();            

        return aq;          

这就是我的答案。

var query = from kur in kurToplamlist
                    where kur.KurToplamMiktarGetSet > 0
                    join cariBilg in db.TBLP1CARIs
                                  on kur.CariIdGetSet equals cariBilg.ID
                    select new
                    {
                        cariBilg.ID,
                        EUROBAKIYE = cariBilg.HESAPADI,
                        cariBilg.K_FIRMAADI,
                        cariBilg.K_YETKILIADI,
                        cariBilg.K_FIRMATELEFON,
                        cariBilg.K_YETKILITELEFON,
                        AUDBAKIYE = cariBilg.B_CEPTELEFON,
                        TLBAKIYE = String.Concat(kur.KurToplamMiktarGetSet.ToString(), kur.DovizTuruGetSet.ToString()),   


                    };
        var dfg = from qre in query
                  select qre.TLBAKIYE;

        var aq = (from qw in query
                  select new { 
                        qw.ID,
                        EUROBAKIYE = qw.EUROBAKIYE,
                        qw.K_FIRMAADI,
                        qw.K_YETKILIADI,
                        qw.K_FIRMATELEFON,
                        qw.K_YETKILITELEFON,
                        AUDBAKIYE = qw.AUDBAKIYE,
                        TLBAKIYE = String.Join(",", (from qre in query
                                                    where qre.ID == qw.ID
                                                    select qre.TLBAKIYE).Distinct())

                 }).Distinct();            

        return aq;          

This is my answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文