如何使用 C# 创建数据透视表?
我需要创建一个像这样的数据透视
BatchID-1 BatchID-2
BachName-1 BachName-2
Chemical-1 0.1 null
Chemical-2 null 0.3
BatchID,BatchName 是 Sql Server 表的列。 在这里,我需要显示特定化学品的值,如果特定 BatchID 和 BatchName
任何人都可以帮助我。
谢谢
I need to create a pivot like this
BatchID-1 BatchID-2
BachName-1 BachName-2
Chemical-1 0.1 null
Chemical-2 null 0.3
BatchID,BatchName are columns of the Sql Server Table.
Here i need to display the value of specific chemical if Specific BatchID and BatchName
Can any one please help me.
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议学习一些 SQL、C# 和数据透视表。然后写一些代码。最好让它编译。
一旦您了解了所有这些事情,您可能就能够提出更精确的问题,例如“使用 Xxx Pivot 控件,我尝试使用此 SQL 查询从 SQL Server 读取数据并尝试填充数据,但是我遇到这个特定问题...”
此时,stackoverflow 可能会有助于回答您的问题。在那之前,我认为没有人会给你所需的代码,因为编写代码可能是你应该自己学习(如果是学生)、成长(如果业余)或获得报酬(专业)的事情。
I suggest leaning a bit of SQL, a bit of C# and a bit about pivot table. Then write some code. Preferably, make it compile.
Once you know all these things, you'll probably be able to ask a more precise question, such as "Using the Xxx Pivot control, I try to read data from SQL server using this SQL query and try to populate the data, but I encounter this specific issue..."
At that point, stackoverflow will probably be helpful in answering your question. Until then, I don't think anyone is going to give you the code you require, as writing code is probably what you should be doing yourself to learn (if student), grow (if amateur) or get paid (professional).
使用诸如 XtraPivotGrid (DevExpress) 之类的控件,或一些免费的控件选择
Use a control such as XtraPivotGrid (DevExpress), or some free alternative
编写存储过程或 LINQ 语句。
Write a stored procedure, or a LINQ statement.