使用 VS 2005 C# 将 Excel 转换为 Oracle 数据库

发布于 2024-08-19 15:18:01 字数 227 浏览 4 评论 0原文

我想构建一个实用程序,可以将 Excel 工作表(列是固定的,但工作表可以是任意数量)中的数据导入到 Oracle 数据库。你能建议我应该如何:

  1. 阅读Excel表格(n个数字)?(最好的方法)
  2. 验证数据?
  3. 批量插入数据库?

我关心的是这里的表现。每张纸可以有 200,000 多行。

PS - 请记住我是 Oracle 的新手。

I want to build a utility that can import data from excel sheet(columns are fixed but sheets can be any number) to oracle db. Can you suggest how should I:

  1. Read excel sheets(n number)?(Best way)
  2. Validate data?
  3. Bulk insert into DB?

My concern is performance here. Each sheet can have 200,000+ rows.

PS - please remember I am a complete newbie to oracle.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

注定孤独终老 2024-08-26 15:18:01

您可以使用 Microsoft Integration Services 并用它批量加载文件

另一种方法是将 excel 工作表转换为 cvs 并通过 Oracle Loader 加载它们

http://www.orafaq.com/wiki/SQL*Loader_FAQ

You can use Microsoft Integration Services and bulkload the files with it

Another way is to convert the excel sheets into cvs and load them via Oracle Loader

http://www.orafaq.com/wiki/SQL*Loader_FAQ

财迷小姐 2024-08-26 15:18:01

SpreadsheetGear for .NET 是一个与 Excel 兼容的电子表格组件,很容易在 C# 中使用,并且允许您获取来自单元格的原始未格式化数据,或每个单元格的格式化文本。

您可以此处查看实时示例并下载免费试用版此处

免责声明:我拥有 SpreadsheetGear LLC

SpreadsheetGear for .NET is an Excel compatible spreadsheet component which is easy to use from C# and will allow you to get the raw unformatted data from cells, or the formatted text of each cell.

You can see live samples here and download the free trial here.

Disclaimer: I own SpreadsheetGear LLC

宁愿没拥抱 2024-08-26 15:18:01

可以使用 ODBC 驱动程序从 Excel 中直接连接到 Oracle 数据库。

根据数据操作的复杂程度,您可以使用 VBA 或 .Net Office Interops。

使用 Visual Studio 进行 Office 开发

It is possible to connect directly to an Oracle database from within Excel using an ODBC driver.

Depending on how complex you data manipulations are you can then use either VBA or the .Net Office Interops.

Office Development with Visual Studio

伊面 2024-08-26 15:18:01

如果您只想快速加载数据。您可以考虑将电子表格导出为 CSV。然后将其作为外部表安装在数据库中。

然后,您可以在插入主表之前使用 PL/SQL 查询和验证数据。

If you just want to load data very quickly. You could consider exporting the spreadsheet to a CSV. Then mounting it in your database as an External Table.

You could then use PL/SQL to query and validate the data before inserting into your main tables.

夜吻♂芭芘 2024-08-26 15:18:01

看看 StackOverflow 中的这个问题:

Create Excel (.XLS and .XLSX) file from C#

我想你可以打开您的工作簿并处理其数据、执行验证等。然后您可以使用标准 SQL 插入将数据插入 Oracle 数据库中。当您使用 NPOI 时,这会变得很容易。

如果您有快速处理器和可用 RAM,性能可能不是问题。

以下文章向您展示如何使用 ASP.NET MVC 应用程序打开工作簿并处理数据:

在 C# 中创建 Excel 电子表格 .XLS 和 .XLSX

Take a look at this question in StackOverflow:

Create Excel (.XLS and .XLSX) file from C#

I think you can open your workbook and process its data, perform validation, etc. You can then use standard SQL inserts to insert the data in Oracle database. This gets easy when you use NPOI.

Performance may not be the problem if you have a fast processor and RAM available.

The following post shows you how to open the workbook and process data using an ASP.NET MVC application:

Creating Excel spreadsheets .XLS and .XLSX in C#

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文