来自Excel的C#查询语句

编程入门 行业动态 更新时间:2024-10-14 20:25:22
本文介绍了来自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#查询语句

本文发布于:2023-11-07 23:40:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   Excel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!