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

Text File Import

I am importing a delimited ASCII text file into a dataset using OLEDB.
I set up the connection and dataadapter and then fill the dataset.
It works - sort of.

It turns out that some of my data is omitted. Specifically, one of the
columns is set to Int32, but the data is really string.
The first few rows of data have numeric valus in this field but further down
there are some letters mixed in with the numbers. So only fields with pure
numbers are imported.

I tried building the table in code before importing and specifying this
field as String.
The import occurred but the data was still missing.

Seems like the import process is deciding things for me "behind the scenes".
Any ideas how to get all the data loaded?

Would it help if I put string data in that column in the first row of data?
Would the import then "guess" that the column datatype is string and not
Int32?
How would I handle this since for an arbitrary file which may not have
string data in that column in row 1?
--
Joe Fallon

Nov 21 '05 #1
7 2312
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon" <jf******@nospamtwcny.rr.com> wrote:

¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further down
¤ there are some letters mixed in with the numbers. So only fields with pure
¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the scenes".
¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of data?
¤ Would the import then "guess" that the column datatype is string and not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a schema.ini file:

http://msdn.microsoft.com/library/de...a_ini_file.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon" <jf******@nospamtwcny.rr.com> wrote:

¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further down
¤ there are some letters mixed in with the numbers. So only fields with pure
¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the scenes".
¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of data?
¤ Would the import then "guess" that the column datatype is string and not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a schema.ini file:

http://msdn.microsoft.com/library/de...a_ini_file.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #3
Paul,
Thanks. That is a good reference and should do the trick.
Finding information on schema.ini used to be much harder. This page pretty
much has it all.
--
Joe Fallon

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:lt********************************@4ax.com...
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon"
<jf******@nospamtwcny.rr.com> wrote:

¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further
down
¤ there are some letters mixed in with the numbers. So only fields with
pure
¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the
scenes".
¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of
data?
¤ Would the import then "guess" that the column datatype is string and not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a
schema.ini file:

http://msdn.microsoft.com/library/de...a_ini_file.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #4
Paul,
Thanks. That is a good reference and should do the trick.
Finding information on schema.ini used to be much harder. This page pretty
much has it all.
--
Joe Fallon

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:lt********************************@4ax.com...
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon"
<jf******@nospamtwcny.rr.com> wrote:

¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further
down
¤ there are some letters mixed in with the numbers. So only fields with
pure
¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the
scenes".
¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of
data?
¤ Would the import then "guess" that the column datatype is string and not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a
schema.ini file:

http://msdn.microsoft.com/library/de...a_ini_file.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #5
Paul et al,

We ran into a similar issue and discovered the schema.ini file that kind of
solved the issue but one disadvantage with the schema.ini file is that it's
expecting a static filename as a first parameter; in our case the file name
keeps changing - the timestamp is appended to the filename to enforce the
uniqueness. Do you (or anyone) have a workaround ?

thanks in advance

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:lt********************************@4ax.com...
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon" <jf******@nospamtwcny.rr.com> wrote:
¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further down ¤ there are some letters mixed in with the numbers. So only fields with pure ¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the scenes". ¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of data? ¤ Would the import then "guess" that the column datatype is string and not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a schema.ini file:
http://msdn.microsoft.com/library/de...a_ini_file.asp

Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #6
Paul et al,

We ran into a similar issue and discovered the schema.ini file that kind of
solved the issue but one disadvantage with the schema.ini file is that it's
expecting a static filename as a first parameter; in our case the file name
keeps changing - the timestamp is appended to the filename to enforce the
uniqueness. Do you (or anyone) have a workaround ?

thanks in advance

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:lt********************************@4ax.com...
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon" <jf******@nospamtwcny.rr.com> wrote:
¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further down ¤ there are some letters mixed in with the numbers. So only fields with pure ¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the scenes". ¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of data? ¤ Would the import then "guess" that the column datatype is string and not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a schema.ini file:
http://msdn.microsoft.com/library/de...a_ini_file.asp

Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #7
FYI
Defining the columns and datatypes in the schema.ini file worked perfectly.

I build it on the fly so entering a unique file name in the first row is now
problem.
--
Joe Fallon

"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Paul,
Thanks. That is a good reference and should do the trick.
Finding information on schema.ini used to be much harder. This page pretty
much has it all.
--
Joe Fallon

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:lt********************************@4ax.com...
On Sat, 8 Jan 2005 00:15:41 -0500, "Joe Fallon"
<jf******@nospamtwcny.rr.com> wrote:

¤ I am importing a delimited ASCII text file into a dataset using OLEDB.
¤ I set up the connection and dataadapter and then fill the dataset.
¤ It works - sort of.
¤
¤ It turns out that some of my data is omitted. Specifically, one of the
¤ columns is set to Int32, but the data is really string.
¤ The first few rows of data have numeric valus in this field but further
down
¤ there are some letters mixed in with the numbers. So only fields with
pure
¤ numbers are imported.
¤
¤ I tried building the table in code before importing and specifying this
¤ field as String.
¤ The import occurred but the data was still missing.
¤
¤ Seems like the import process is deciding things for me "behind the
scenes".
¤ Any ideas how to get all the data loaded?
¤
¤ Would it help if I put string data in that column in the first row of
data?
¤ Would the import then "guess" that the column datatype is string and
not
¤ Int32?
¤ How would I handle this since for an arbitrary file which may not have
¤ string data in that column in row 1?

If you're having conversion issues then you'll probably need to use a
schema.ini file:

http://msdn.microsoft.com/library/de...a_ini_file.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)


Nov 21 '05 #8

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

Similar topics

1
by: Chris | last post by:
Background: I am using a MS Access 2000 front end with SQL Server 8.0 back end. I have the requirement to import all text files (regardless of filename) from a given folder on the network into a...
1
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no...
5
by: Johnny Meredith | last post by:
I have seven huge fixed width text file that I need to import to Access. They contain headers, subtotals, etc. that are not needed. There is also some corrupt data that we know about and can...
2
by: Michael Thomas | last post by:
Hi everyone Do any of you know if this is possible in Access either by using the import tool or by writing a module in VB: I have a database containing information for a retail chain which,...
2
by: Phil Latio | last post by:
We have despatch process which kicks out picking information into text files at hourly intervals. The text files are named sequentially by process; 'ABC.txt', 'ABC01.txt', 'ABC02.txt' for one...
1
by: ghadley_00 | last post by:
Hi, I have a MS access database table for which I regularly need to import fixed width text data. At present I have to to cut and paste the text data from its source to a text file, save the...
13
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them...
1
by: Child of His | last post by:
I have been through every trick I know, or has been suggested. I have a one to two million line fixed field database in text format. I want to bring it into Access 97. When I use the external...
4
by: chimambo | last post by:
I have 2 problems: 1. I want to import a single text file into an access table using a Macro. I am however getting an error that I need to put a specification name argument. What does this mean?...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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,...

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.