如何将数据从Excel存储到数据库 [英] How Do I Store Data From Excel To Database

查看:137
本文介绍了如何将数据从Excel存储到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel数据,如

I have a excel data like

pincode         city              state           country
 251010      hyderabad          telanagana           india
 524303      Nellore            AndhraPradesh        india
 25411       Banglore            Karnataka           india
  10110      Vegas                USaState            USA





使用c#代码我想存储如下图所示



我想在数据库表中存储excel文件,如下面所示格式

动态使用c#和linq





by using c# code I want to store as shown in below

I want to store above excel file in database table like as shown in below format
dynamically using c# and linq

id  Parentid  Type         Text
 1    0        Country     India
 2    0        Country     USA
 3    1        State       AndhraPradesh
 4    2          State      USAState





怎么能实现这一个请帮帮我



how can is achieve this one please help me out

推荐答案

沿着w上面发布的CP文章也检查了这个:

使用ASP.Net C#将Excel文件记录插入SQL Server数据库 [ ^ ]
Along with the CP article posted above check this one too:
Inserting Excel File Records Into SQL Server Database Using ASP.Net C#[^]


你好,



关于将excel文件转换为db文件的帖子非常详细。



这是< a href =http://www.wikihow.com/Create-a-Database-from-an-Excel-Spreadsheet>链接



我希望这可以帮到你。
Hi there,

There is a very detailed post about converting excel file to db files.

Here is the Link

I hope this helps you.


试试这个



使用ASP中的C#将数据从excel导入SQL服务器。 NET [ ^ ]


这篇关于如何将数据从Excel存储到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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