I am reading a text file with many rows, the columns are separated with ";" .
On one column, named "agent" I have diferent types of data, text and numbers.
I am using the following code to read the text file:

OleDbConnection cnnT = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=" + cale + ";"
+ "Extended
Properties='text;HDR=Yes;FMT=Delimited';");
cnnT.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * from test.txt", cnnT);
ds.Clear();
da.Fill(ds,"Table1");

My problem is ,that after the data is read, in the column "agent" all the
rows where i have strings, or where the numbers are larger then 10 digits,
the value in my dataSet is null. So I only read numbers that are smaler then
10 digits.

How can I set the data type to read?
I have tried to use a schema.ini file, but it dose not work.

Re: How to set the data type to read from a text file by Paul

Paul
Thu May 08 09:31:57 CDT 2008

On Wed, 7 May 2008 06:26:01 -0700, Akira <Akira@discussions.microsoft.com> wrote:

¤ I am reading a text file with many rows, the columns are separated with ";" .
¤ On one column, named "agent" I have diferent types of data, text and numbers.
¤ I am using the following code to read the text file:
¤
¤ OleDbConnection cnnT = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
¤ + "Data Source=" + cale + ";"
¤ + "Extended
¤ Properties='text;HDR=Yes;FMT=Delimited';");
¤ cnnT.Open();
¤ OleDbDataAdapter da = new OleDbDataAdapter("Select * from test.txt", cnnT);
¤ ds.Clear();
¤ da.Fill(ds,"Table1");
¤
¤ My problem is ,that after the data is read, in the column "agent" all the
¤ rows where i have strings, or where the numbers are larger then 10 digits,
¤ the value in my dataSet is null. So I only read numbers that are smaler then
¤ 10 digits.
¤
¤ How can I set the data type to read?
¤ I have tried to use a schema.ini file, but it dose not work.

You need to create a schema.ini file:

http://msdn.microsoft.com/en-us/library/ms709353.aspx


Paul
~~~~
Microsoft MVP (Visual Basic)