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

Reading CSV File into SQL never completes

(ASP.NET c# Question)

Hi, I have this odd problem:

I receive a CSV File through file upload. Using an OleDB.Datareader i read
each row of the file and insert it into SQL.

The problem is that for some reason when the file goes over 15k the program
gets stuck. All rows are read and inserted correctly into SQL. The program is
not generating duplicate entries. It is just there waiting for something
until the session expires.

I tried generating a Dataset and reading from there into SQL but the result
is the same. Ialso tried saving the file into xml and reading from a dataset
of this XML file but the result is the same.

Thanks in advance
Feb 3 '06 #1
2 6406
"Antonio Tirado" <An***********@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
(ASP.NET c# Question)

Hi, I have this odd problem:

I receive a CSV File through file upload. Using an OleDB.Datareader i read
each row of the file and insert it into SQL.

The problem is that for some reason when the file goes over 15k the
program
gets stuck. All rows are read and inserted correctly into SQL. The program
is
not generating duplicate entries. It is just there waiting for something
until the session expires.

I tried generating a Dataset and reading from there into SQL but the
result
is the same. Ialso tried saving the file into xml and reading from a
dataset
of this XML file but the result is the same.

Thanks in advance


I'm always amazed when someone uses an OleDB data reader to read a CSV file.
Why on earth would you do that? You don't get the control over error
handling that you would get if you simply read the data in a stream and
parsed it yourself. CSV is SO simple that it just doesn't make sense to use
an adapter, especially one that conforms to a database interface, to
interpret it for you.

The culprit is probably your data. If you have a double-quote in the data,
then your adapter is looking for a close quote. On the other hand, perhaps
you have no CRLF at the endof the last line, where the adapter is expecting
a CRLF at the end of the last line. Look at the data... it's probably the
culprit.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
Feb 4 '06 #2
I'm using the OleDB reader because I save on coding to parse each row. The
OleDB component returns an object[] for which I only have to cast to obtain
and use a variable in its format and not a standard string. You might lose
some control but I think you gain in functionality.

The use of double-quotes is standard in CSV files and the OleDB component
interprets them perfectly.Though I think it is looking for the <EOF>
character.

"Nick Malik [Microsoft]" wrote:
"Antonio Tirado" <An***********@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
(ASP.NET c# Question)

Hi, I have this odd problem:

I receive a CSV File through file upload. Using an OleDB.Datareader i read
each row of the file and insert it into SQL.

The problem is that for some reason when the file goes over 15k the
program
gets stuck. All rows are read and inserted correctly into SQL. The program
is
not generating duplicate entries. It is just there waiting for something
until the session expires.

I tried generating a Dataset and reading from there into SQL but the
result
is the same. Ialso tried saving the file into xml and reading from a
dataset
of this XML file but the result is the same.

Thanks in advance


I'm always amazed when someone uses an OleDB data reader to read a CSV file.
Why on earth would you do that? You don't get the control over error
handling that you would get if you simply read the data in a stream and
parsed it yourself. CSV is SO simple that it just doesn't make sense to use
an adapter, especially one that conforms to a database interface, to
interpret it for you.

The culprit is probably your data. If you have a double-quote in the data,
then your adapter is looking for a close quote. On the other hand, perhaps
you have no CRLF at the endof the last line, where the adapter is expecting
a CRLF at the end of the last line. Look at the data... it's probably the
culprit.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--

Feb 5 '06 #3

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

Similar topics

14
by: edykstra | last post by:
Hello, If you point your browser to this page, http://prdownloads.sourceforge.net/vnc-tight/tightvnc-1.2.9_x86_viewer.zip?use_mirror=umn the server sends you the HTML page, and very soon...
8
by: IGC | last post by:
I have a requirement to record in a database when a file is finished downloading to the end-user. Currently when a user clicks a download icon for a file it directs to an ASP page that records the...
1
by: Greg Lindstrom | last post by:
I have an odd problem that I'm sure someone here can help me solve. I am using Python 2.3 on a Linux box to process text files. At one point in my automated process, I have to zip and ship the...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
2
by: mboyda | last post by:
I have a block of code that useses outputstream to save a pdf to a client computer. It prompts the user with the save dialog, works great but the response finishes after the download completes. ...
4
by: Patrick Altman | last post by:
I am attempting to use a HEAD request against Amazon S3 to check whether a file exists or not and if it does parse the md5 hash from the ETag in the response to verify the contents of the file so...
0
by: ravirajdanasekaran | last post by:
I have written a web form which downloads files to the client automatically. After the download completes, I would like to delete the file that was downloaded. I can't tell how to wait until the...
13
by: cmdolcet69 | last post by:
I have this code below that will open a created file and read the file to the end. However if my file has values 200,300,400 seperated by commas how can i read in each seperate value and place it...
10
by: puzzlecracker | last post by:
Say I want to arrange bytes in the internal buffer in a certain way. I receive those bytes in the socket. One solution is to read in socket in pieces: byte buffer = new byte; int index = 0;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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.