473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to import Excel File Data in oracle table using C#?

I want to import Excel File Data in oracle table using C#. I have fetched the data from excel file but getting problem on transfering this data into oracle table.Below is my code:

string filpath = "";
string fname = "";
if (flUpload.HasFile)
{
filpath = flUpload.ResolveClientUrl(flUpload.PostedFile.File Name);
fname = flUpload.FileName.ToString();
Int32 indx = flUpload.FileName.LastIndexOf(".");
String ext = flUpload.FileName.Substring(indx + 1);

if (ext == "xls" || ext == "xlsx")
{
//Connection String to Excel
string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filpath + ";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1\"";

//Create Connection to Excel
OleDbConnection Connection = new OleDbConnection(excelConnectionString);

//Create OleDbCommand to fetch data from Excel
OleDbCommand Command = new OleDbCommand("Select [UserADID], [UserName], [mailid] FROM [Mentor Expert Users$] where [UserADID] is not null", Connection);
Connection.Open();
OleDbDataReader dr = Command.ExecuteReader();

OracleBulkCopy bulkcopy = new OracleBulkCopy(GetConnectionString());
bulkcopy.DestinationTableName = "TBL_USER_ACCOUNTS";
bulkcopy.WriteToServer(dr);

Connection.Close();
}


Please help me. its urgent
Mar 29 '12 #1
0 3495

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jimsun | last post by:
Hi All, I've got an XML file together with the XML Schema xsd file. I want to load the file in an Oracle table using .Net + C#. Can anyone guide me through the process or any link whereby i...
1
by: motiur rahman | last post by:
Hi , i m worry about how to import excel worksheet into oracle table via PL/SQL code.
1
by: Randoz | last post by:
I recieve an updated excel file with pers information every other week and when I go to import the data into my table the data is not updated for the records that are linked to a course table. I...
0
by: steve waugh | last post by:
Hi All I want to upload the data from excel sheet to oracle Data Base's Table thorugh ASP.NET 2.0. i also want to perform all validations on excel's Row means Data should not contain & or '...
6
by: raviva | last post by:
Hi, I need to create a script to load Excel file into oracle tables. Please help if you have worked on anything like this. I have been doing this converting Excel to CSV manually and then running...
3
by: nspader | last post by:
Hello All, This seems like it should be simple but I cannot figure it out. I am trying to set up a button click to import an excel file to a temp table then run an append query to add it to an...
5
by: sumanta123 | last post by:
Dear Sir, How to export/import the excel file in oracle database using sql promt. Please guide me the command(export/import) for the neddful. Thanks in Adavance. Regards Sumanta Panda
1
by: vikassawant | last post by:
Hi, I want to import Excel file data in JTable.For that I am using following Code, String excelFileName = "Team1.xls"; File file = new File(excelFileName ); //‘file’ is the file you...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
4
by: goodamr | last post by:
Hi, I have many Excel files (more than 200 files). I'm using TOAD to import the Excel files into the Oracle table, but this process is boring and time-consuming especially for this huge number of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.