PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET How to set the data type to read from a text file

Reply

How to set the data type to read from a text file

 
Thread Tools Rate Thread
Old 07-05-2008, 02:26 PM   #1
Akira
Guest
 
Posts: n/a
Default How to set the data type to read from a text file


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.

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off