如何使用C#使用ASP.NET将数据从Excel导入Sql [英] How to Import datas to Sql From Excel using asp.net with C#

查看:249
本文介绍了如何使用C#使用ASP.NET将数据从Excel导入Sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Excel中的所有数据列复制到Sql数据库.怎么做

请任何人帮助解决此问题

谢谢

I want to Copy all the data columns in Excel to Sql database . How to do it

Please anybody help for this Problem

Thank you

推荐答案

亲爱的任务很简单

在excel数据库中使用相同数量的字段在sql数据库中创建一个新表
然后从excel复制数据,然后在sql表中选择第一行并粘贴(Ctrl + V)sql将解析粘贴的数据.

我希望我能回答您的问题,否则请回复给我


谢谢
Dear it is very simple task

create a new table in your sql database with the same number of fields in the excel
then copy the data from the excel then select the first row in the sql table and paste (Ctrl+V) the sql will parse the pasted data.

i hope i respond to your question if not please reply that to me


thanks


您需要通过oledb连接字符串与excel表连接
通过选择查询选择所有记录.
那么您可以通过以下方法将其插入
1.批量复制
2.通过循环+插入查询
You need to connect with excel sheet by oledb connection string
Select all record by select query .
then you can insert it by following methods
1. Bulk copy
2. by looping + insert Query


这篇关于如何使用C#使用ASP.NET将数据从Excel导入Sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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