如何将数据从Excel工作表导入到SQL Server 2005 [英] how to import data from excel sheet to sql server 2005

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

问题描述

先生,
我想将数据从Excel工作表导入sql server 2005

plz,rply
感谢advnc

sir,
i want to import datafrom excel sheet to sql server 2005

plz, rply
thanks in advnc

推荐答案

u可以从excel表中读取数据,就像您从数据库中读取数据一样.根据Microsoft Office版本,仅连接字符串会更改.

例如,
u can read data from excel sheet in the same way u do from database. Only the connection string will change depending on microsoft office version.

For eg.,
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";


如果不起作用,您可以从以下网站搜索其他人:http://www.connectionstrings.com/excel

然后,对于数据访问查询,表名将是带有"


If it dont work, u can search others from: http://www.connectionstrings.com/excel

Then for data access query, thhe table name will be the sheet name with ''


"符号的工作表名称.例如,假设工作表名称为"Sheet1",查询将为:
'' sign appended. For eg, suppose sheet name is "Sheet1", query will be:
select * from [Sheet1



您可以使用您的数据访问方法(例如OledbConnection和OledbCommand)将数据读入DataTable.之后,使用ur方法,您可以将其插入sql server数据库. :)


U can read data by using your data access method (e.g. OledbConnection and OledbCommand) into DataTable. After that, using ur method, u can insert into sql server database. :)


这篇关于如何将数据从Excel工作表导入到SQL Server 2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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