本文介绍了Winform合并两列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以基本具有2个列标题的4列形式创建一个datagridview,即我只想合并2列的列标题.
I want to create a datagridview in a form with 4 columns basically which has only 2 column headers, ie i want to merge only the column headers of 2 columns.
预先感谢
推荐答案
我假设您要绑定到sql提供的数据表,对吗?如果是这样,为什么不将结果合并到数据表中并进行绑定.更简单,编程更少.
i assume you're binding to a sql-provided datatable, right? If so, why not combine the results in your datatable and bind that. Simpler, with less programming.
例如
SELECT col1 + ' ' + col2, col3 + ' ' + col4 FROM someTable ORDER BY col1 + ' ' + col2
财务版本:
SELECT col1 + ' ' + col2 AS 'Fancy Column Name 1' ,
col3 + ' ' + col4 AS 'Fancy Column Name 2
FROM someTable ORDER BY col1 + ' ' + col2
这篇关于Winform合并两列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!