473,396 Members | 1,865 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,396 software developers and data experts.

Problem in loading Excel file.

Hi!
I am making connection to excel.
But all fields which are not of string type are being read as null.
---------------code-------------------------------
excelConnection = new System.Data.OleDb.OleDbConnection(
@"provider=Microsoft.Jet.OLEDB.4.0;data source="+file+"; Extended
Properties=\"Excel 8.0;HDR=No\"");

excelConnection.Open();

//Guid guid = new Guid();

System.Data.DataTable schema =
excelConnection.GetOleDbSchemaTable(System.Data.Ol eDb.OleDbSchemaGuid.Tables
,null);
string firstSheetName;

firstSheetName = schema.Rows[0]["TABLE_NAME"].ToString();

excelCommand = new System.Data.OleDb.OleDbCommand( "select * from
["+firstSheetName+"A:AL]", excelConnection);

excelCommand.CommandType = CommandType.Text;
excelDa = new OleDbDataAdapter(excelCommand);

excelDs = new System.Data.DataSet();

excelDa.Fill(excelDs);

excelFileTable = excelDs.Tables[0];

DataRow dataRow;

dataRow = excelFileTable.Rows[i];

---------------code-------------------------------

All elemetns of dataRow which are not string are null.

Any Idea?

Thanks.




Nov 15 '05 #1
0 1778

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ornez | last post by:
Hi, I need to enable the IE user to upload/select a file .Then i have to validate the data and put it in a grid/table . Using input type=file will save it on the server where there is no need...
8
by: mytfein | last post by:
Hi Everyone, Background: Another department intends to ftp a .txt file from the mainframe, for me to process. The objective is to write a vb script that would be scheduled to run daily to...
0
by: Alpha Zero | last post by:
Hi! I am making connection to excel. But all fields which are not of string type are being read as null. ---------------code------------------------------- excelConnection = new...
0
by: MAT | last post by:
Hi. In my C# Application I open an Excelworkbook and try to write some data to it. The excel file has some macros,which are disabled (Macro security is high). One of the macros try to load an...
2
by: ammu001 | last post by:
I got this much information regarding excel file I want to display. strFileName contains the entire file path. Dim theWorkbook As Excel.Workbook theWorkbook =...
1
by: No_Spam | last post by:
I'm using Microsoft Excel Object 11.0 (Microsoft.Office.Interop.Excel) to open excel from my web application and set few cells values before displaying it to users. When I deployed the website to...
2
by: Nicholas Dreyer | last post by:
The following error Run-time exception thrown : System.Runtime.InteropServices.COMException - Error loading type library/DLL. happens while running the code listed at the bottom of this...
0
by: wankhusairi | last post by:
hallo sir .. i am still new on using vb and i have tried to load an excel using a visual basic interface.. but if i wanted to plot my excel data what should i do.. must i cahnge my program on loading...
0
VietPP
by: VietPP | last post by:
Hi all, I've asked too much question in this day, hehe. I'm trying to export my table data in OracleDB to excel. The problem is my charset in database is US7ACSII (using Vietnamese font), when...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.