Excel导入依赖于在C#中进入oracle的条件失败 [英] Excel import depends on condtion into oracle in C# fails on conditions

查看:70
本文介绍了Excel导入依赖于在C#中进入oracle的条件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在excel工作表中导出数据时在c#中编写了一个条件



OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter(SELECT * FROM+ SpreadSheetName +where [Serial数字]<> null,ExcelConnection);



当我尝试导入1000行时,只有插入500个连续项n条件以RIUYOI78589649开头时失败系列。



Excel数据序列号389423576528635。 .//upto 5000 RIUYOI78589649 //序列号501。 。 .1000



如果我从不同的excel表单独导入它们,一切都按预期工作



我尝试了什么:



案例1:我试图导出数据序列没有从RIUYOI78589649开始,然后是389423576528635,在这种情况下它工作正常

I wrote a condition in c# while exporting the data from excel sheet

OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter("SELECT * FROM " + SpreadSheetName + " where [Serial Number] <>null ", ExcelConnection);

When I tried to import 1000 lines its only inserting 500 serials items n conditions fails when it starts with "RIUYOI78589649" series.

Excel Data Serial Number 389423576528635 . .//upto 5000 RIUYOI78589649//serial no 501 . . .1000

If I imported them individually from different excel sheets everything is working as expected

What I have tried:

Case 1: I tried to export data serial no starts from RIUYOI78589649 and followed by 389423576528635 in this case its working fine

推荐答案

我会将excel文件加载到 DataTable 对象中,然后从<$ c添加记录$ c> DataTable 对象进入数据库。



这篇CP文章包含一个将Excel导入 DataTable的类(并且可以很好地确定正确的列数据类型)。



SQLXAgent - SQL Express的工作 - 第3部分,共6部分 [ ^ ]



在使用代码之前,请务必*阅读文章*。它会有很大的帮助。
I would load the excel file into a DataTable object, and then add the records from the DataTable object into the database.

This CP article includes a class that imports Excel into a DataTable (and does a pretty good job of determining the correct column data types on the fly).

SQLXAgent - Jobs for SQL Express - Part 3 of 6[^]

Be sure to *read the article* before using the code. It will help immensely.


这篇关于Excel导入依赖于在C#中进入oracle的条件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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