在c#中将excel导入数据表时,数据表头文本未完全导入 [英] datatable header text not importing completely while importing excel to datatable in c#

查看:307
本文介绍了在c#中将excel导入数据表时,数据表头文本未完全导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要求通过c#加载excel数据并保存到数据库中,

我发现列标题限制为64个字符。

例如列标题是

这是excelsheet中包含超过64个字符的列标题



导入数据后,数据表列将是

这是超过64个字符的列标题







我使用OleDbConnection读取数据

和连接字符串是

Provider = Microsoft.ACE.OLEDB.12.0; Data Source = {0}; Extended Properties ='Excel 12.0; HRD = YES; IMEX = 1;'

请帮帮我摆脱这个问题



提前谢谢。

We have a requirement to load excel data through c# and save into database ,
I observed that column header is limit to 64 characters .
for example column header is
"this is the column header with more than 64 characoters in excelsheet"

after importing data ,Data table column will be
this is the column header with more than 64 characoters in exce



I used OleDbConnection to read the data
and connection string is
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0;HRD=YES;IMEX=1;'"
Please help me to get out of this problem

Thanks in advance .

推荐答案

你好,有一个代码项目请参考导入MS Excel链接数据到SQL Server表使用C# [ ^ ]


这篇关于在c#中将excel导入数据表时,数据表头文本未完全导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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