导入数据时更改默认列标题 [英] Change default column header while importing data

查看:66
本文介绍了导入数据时更改默认列标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi,

I have a gridview which has 4 columns in total now the first column name i am importing from an excel sheet which is named as "FileName".the gridview is taking columnheader as F1 instead of filename.i need that f1 to be replaced with my column header name.





什么我试过了:





What I have tried:

so far i have tried 

                         dataGridView1.Columns[0].Name = "Filename";
                      
                       dtExcel.Columns.Add("Filename");
                    
                    dataGridView1.Columns[0].HeaderText = "Filename"
                    
                    by this all new column of filename is getting added but that F1 is not getting replaced.
                   
                    
                    Help Please.

推荐答案

解决了这个问题,我只需要更改

从[Sheet
resolved this myself just needed to change the Query from
select * from [Sheet


中选择*从[Sheet
to select F1 as Filename from [Sheet

中选择F1作为文件名>






感谢帮助人员。


thanks for the help guys.


这篇关于导入数据时更改默认列标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆