473,569 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in uploading Date from Excel

Hi,
I am facing a problem in uploading Excel data to the Database. While
uploading my code reads Excel Data using OleDbReader and store into a dataset
by looping through the OleDbReader result set. The problem is, if I give the
date as mm/dd/yyyy format it accepts, but when I give the date in dd/mm/yyyy
format, upto 8 rows of data it is reporting the date as invalid. After 8th
row even if the date is there (dd/mm/yyyy format), it is reporting like Date
field is blank (the OleDbReader itself is reading the date as blank.) I am in
a crucial situation to get a solution for this problem. Can anyone please
help me.
Thank You,
Regards,
N.Ramakrishnan

//Following is the Code I use to read Excel Data using OleDbReader
string prop = "\"Excel 8.0;IMEX=1;HDR= YES\"";
string strConn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=";
strConn = strConn + filePath + ";";
strConn = strConn + "Extended Properties=";
strConn = strConn + prop;

OleDbConnection xlCon = new OleDbConnection (strConn);

xlCon.Open();

string selStmt = "SELECT * FROM [" + sheetName + "]";
OleDbCommand xlCmd = new OleDbCommand(se lStmt, xlCon);
xlCmd.CommandTy pe = CommandType.Tex t;
OleDbDataReader xlReader = xlCmd.ExecuteRe ader();
//Create a structure for the dataset
for(short fldIndex = 0; fldIndex < xlReader.FieldC ount; fldIndex++)
{
xlDataSet.Table s[0].Columns.Add(ne w DataColumn(xlRe ader.GetName(fl dIndex),
Type.GetType("S ystem.String")) );
}
DataRow dRow;
while(xlReader. Read())
{
dRow = xlDataSet.Table s[0].NewRow();
for(short fldIndex = 0; fldIndex < xlReader.FieldC ount; fldIndex++)
{
dRow[fldIndex] = Convert.ToStrin g(xlReader[fldIndex]);
}
xlDataSet.Table s[0].Rows.Add(dRow) ;
}
xlReader.Close( );
Mar 30 '06 #1
0 1167

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

Similar topics

4
3932
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear" TEXT field that contains data such as 2000/01, 2001/02, etc. If I export a Query with this kind of data to Excel, it gives me the text value of...
7
5211
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user folder are using this code of url rewrite project is running completely fine on localhost but after uploading first page...
5
2820
by: Rob T | last post by:
I have a routine that imports a list of part numbers into a dataview: strExcel = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & boxFile.Text & ";Extended Properties=""Excel 8.0;HDR=NO""" cnnExcel = New OleDbConnection(strExcel) da = New OleDbDataAdapter("Select * from ", cnnExcel) da.Fill(ds, "Excel") dv = New...
0
7245
by: Alex | last post by:
my app was working fine in VB.NET 2003 (and framework 1.1). Now with VB.NET 2005 (framework 2.0) the uploading to an http server (ie. www.sharebigfile.com) stops with the error "The request was aborted: The request was canceled" after about 7 MB. For example, I might be uploading a 73MB file. After about 11% done the upload aborts. :shake:...
6
3970
by: Piotr | last post by:
Hi, I have following problem: I use a form in excel to send data into mysql server, everything is ok unless I have to deal with decimals or data fields, this simple are not recognized. For example In excel in mySQL 45,45 -> 45 2005-01-01 -> 0000-00-00
2
10044
by: jereviscious | last post by:
Hi all - Last resort time. I'm importing data from a spreadsheet that I receive from one of my vendor using interop.excel. The date field in excel is entered as 4/7/2006, but when I retrieve the value, it returns a double 38449.0. I can't figure out how to convert this value into a proper date. I have no Idea what excel is doing with...
6
7546
by: chiya | last post by:
plz anybody help me in uploading data from excel file to mysql database. data in excel sheet is in vertical format not horizontally. I mean to say that the columns of mysql tables are in rows in excel.
9
2763
by: QCLee | last post by:
Sir can you help me to transfer my Access Query to MS excel? i have a command button on the form to export the parameter query named "HVACWindwardQuery" to excel spreadsheet and i got the codes from searching on the internet and books but the problem is when i run the command button "Export" it just only open the Blank Spreadsheet, no ...
5
3088
by: Tempalli | last post by:
I am uploading MS Excel data to Ms access as detailed below. Ms. Excel A(Column) B(Column) C(Column) ------------------------------------------------------------------------------------ 1 | Apple 2 | Mango 3 | Banana
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6278
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.