将数据从Excel工作表传输到sql数据库 [英] transfer data from excel sheet to sql database

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

问题描述

我有一个包含数据的excel工作表,这些数据我想在使用文件上传控件从aspx页从excel页面上载到excel工作表时存储到sql数据库中.我正在尝试存储数据,但出现以下错误

"Microsoft Office Access数据库引擎无法打开或写入文件"".它已经由另一个用户以独占方式打开,或者您需要查看和写入其数据的权限"


所以请任何人帮我.
并提前感谢...

i have excel sheet that contain data ,that data i want to store into sql database upon excelsheet upload from that aspx page using fileupload controls.i am trying to store data but get error as below

"The Microsoft Office Access database engine cannot open or write to the file ''''. It is already opened exclusively by another user, or you need permission to view and write its data"


so pls any one help me.
and thanks in advance ...

推荐答案

在没有看到您的代码的情况下,几乎不可能确切地说出问题所在,但假设您正在保存该代码.将excel文件上传到硬盘驱动器,请确保保存后关闭FileStream:

http://msdn.microsoft.com/zh-cn/library/system.io.stream.close%28v = vs.100%29.aspx [
Without seeing your code it''s almost impossible to say exactly what the problem is, but assuming you''re saving the uploaded excel file to the hard drive, make sure you''re closing the FileStream after saving:

http://msdn.microsoft.com/en-us/library/system.io.stream.close%28v=vs.100%29.aspx[^]

You can either call Close() explicitly, or wrap the FileStream in a using statement as it implements IDisposable


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

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