Advertisement

07.22.2008 at 10:38AM PDT, ID: 23585883
[x]
Attachment Details

How to input from text/csv and ignore formatting?

Asked by pfcs_sql_admin in Microsoft Visual Basic.Net, Programming for ASP.NET

Tags: Visual Basic .NET, ASP.NET

I apologize for the length of the description.

I have a comma-delimited text file (csv) with upwards of 250 columns in it.  In fact, it can have either 185 or 250!  Furthermore, within this comma separated file, some of the values have commas in it (and no quotes or anything to offset).  Nice huh?  The file comes from a vendor, so that part is out of my hands.

Anyway, the purpose of the utility is to import the file and break the lines into two other files.  The utility doesn't do anything to the file itself and there is no user interaction other than to select the file.  All it does is bring it in, cycle through the lines, and put some of the lines in File A, and some of the in File B.

What I have done is to import the file using an oledb connection to read it in directly, and then .Fill a dataset/datatable.  The default view of that table is used as the source for a hidden datagridview.  The datagridview is used so that I can strip the commas out.  For some reason, reading the csv file in with the oledb breaks it up correctly, allowing me to strip the commas out of the offending values.

However ... the REAL problem began when I realized what the .Fill was doing.  The file contains huge account numbers.  And the moment the account number hits the datatable from the .Fill method, it auto-converts to scientific notation!  I have since modified my code to uncovert them on the way out.  Which lead me to discover a new problem - that since the datatable is created using the values it starts with, later on there is data that doesn't fit the format - so that data is outright ignored and is not imported!

So - here is my question - how can I import from a text file and *ignore* data types? (or set them all to one type)  I merely want to import everything as string columns!  When I tried creating a table with string columns, all it did was append columns to the table (instead of 250, I had 250 strings (empty) and 250 import cols).

How can this be done?  There HAS to be a way!

Start Free Trial
[+][-]07.22.2008 at 11:15AM PDT, ID: 22062055

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 11:31AM PDT, ID: 22062197

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 11:35AM PDT, ID: 22062234

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 12:37PM PDT, ID: 22062857

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 05:38PM PDT, ID: 22065081

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.23.2008 at 05:51AM PDT, ID: 22068642

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 06:48AM PDT, ID: 22069237

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:02AM PDT, ID: 22069383

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:40AM PDT, ID: 22069795

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:43AM PDT, ID: 22069824

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:46AM PDT, ID: 22069859

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:03AM PDT, ID: 22070030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:20AM PDT, ID: 22070222

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 09:11AM PDT, ID: 22070781

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 09:31AM PDT, ID: 22071008

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, Programming for ASP.NET
Tags: Visual Basic .NET, ASP.NET
Sign Up Now!
Solution Provided By: cpkilekofp
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.23.2008 at 09:45AM PDT, ID: 22071130

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:14AM PDT, ID: 22072159

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:57AM PDT, ID: 22072618

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628