简体   繁体   English

C#自定义数据表视图

[英]c# custom datatable view

Can following thing be done? 可以做以下事情吗?

替代文字

The red rectangled datatable should be modified as the other row. 红色矩形数据表应修改为另一行。

I am using c#, DataTable with MS-SQL. 我在MS-SQL中使用c#,DataTable。 I want to give shown type of view of second row to the user in a windows. 我想在窗口中向用户提供第二行显示的视图类型。

I'll be having at least 500-600 rows like this out of 1000 rows. 我将在1000行中至少有500-600行。 Which can be shorten down to 1000-600/3 = 800. (Perhabs, I can take this chance because the operation will not be time consuming.) The user will be having ease in putting data only once in place of puttinig it thrice .. will save time for them and over all performance. 可以将其缩短为1000-600 / 3 =800。(Perhabs,我可以抓住这次机会,因为该操作不会浪费时间。)用户可以轻松地将数据放置一次,而不是三次放置数据。将为他们节省时间,并为整个性能节省时间。

Please ask question for help me solve this problem. 请提出问题以帮助我解决此问题。

Thanks in advance. 提前致谢。

There is an article about this here: https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/ , "Concatenating row values in Transact-SQL". 这里有一篇关于此的文章: https : //www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/ ,“在Transact-SQL中连接行值” 。

The conclusion is that this is not a trivial task and can be achieved using SQL or in code. 结论是,这不是一件容易的事,可以使用SQL或代码来实现。

I would probably perform the database querying in code and then modify the DataTable and databind the grid with the modified DataTable. 我可能会用代码执行数据库查询,然后修改DataTable并将数据与修改后的DataTable绑定到网格。 If the grid allows editing, then you have to perform the reverse transform before saving it to the database. 如果网格允许编辑,则必须先执行反向转换,然后再将其保存到数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM