PC Review


Reply
Thread Tools Rate Thread

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

 
 
Akira
Guest
Posts: n/a
 
      7th May 2008
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
 
 
 
 
Eli
Guest
Posts: n/a
 
      9th Jan 2011
Akir Hello
I Knoe this is old
But did you secseed solvint this.
I have a similer promlem
Thanks
Eli

> On Wednesday, May 07, 2008 9:26 AM Akir 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.



> Submitted via EggHeadCafe
> Microsoft ASP.NET For Beginners
> http://www.eggheadcafe.com/training-...NET/7/ASP.aspx

 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint can't read the outline from no text converter is installed for this file type Alain Dekker Microsoft Powerpoint 7 2nd Nov 2009 07:13 PM
Data Type Mismatch in Expression - can I force a query to read as a diferent data type? S Davis Microsoft Access Queries 1 8th Jun 2007 12:33 AM
How do you save an excel file to be read as IBM-type text file ? =?Utf-8?B?RGVlIEZyYW5rbGlu?= Microsoft Excel Worksheet Functions 2 10th Oct 2006 03:46 AM
Memo data type to text file. Paul Microsoft Access VBA Modules 2 30th Apr 2004 01:25 AM
Text file data type missing. Raj Microsoft Access External Data 1 1st Oct 2003 12:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:40 PM.