来自Excel的C#查询语句 [英] C# Query Statement from Excel

查看:96
本文介绍了来自Excel的C#查询语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我正在开发这样一个数据库应用程序,它从excel中提取数据并将其保存到SQL数据库。



我的程序在生产服务器上工作正常。但是当它从客户端的PC上运行时它会失败。假设我有一个文件C:\test.xlsx。它适用于服务器但不能在客户端PC上工作,同时存在相同的路径/文件。



我正在使用以下查询: -



Dear All,

I am developing such a database application which extract data from excel and save it to SQL Database.

My program is working fine at production server. But when it runs from client's PC it fails. Suppose I have a file "C:\test.xlsx". It works on Server but not working on client PC while same path/files exists.

I am using below queries: -

SELECT * FROM
OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0','Data Source=C:\test.xlsx;Extended Properties=''Excel 12.0 XML;HDR=Yes;IMEX=1;''')...[Sheet1$]





问候,



Anil Kumar



Regards,

Anil Kumar

推荐答案





问候,



Anil Kumar



Regards,

Anil Kumar


这很可能是一个权限问题:大多数机器的根目录这些天受到保护,对它中文件的读写访问默认是禁止的 - 特别是当它是ro时启动盘的目录。



我强烈建议您将数据库存储在更用户友好的位置:我应该在哪里存储我的数据? [ ^ ]应该有所帮助。
It's quite likely that it's a permissions problem: the root directory of most machines is protected these days, and read-write access to files in it defaults to forbidden - particularly when it's the root directory of the boot disk.

I'd strongly suggest that you store your DB in a more "user friendly" location: Where should I store my data?[^] should help.


这篇关于来自Excel的C#查询语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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