By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

Problem in Reading TEXT files using OLEDB

P: n/a

hi

I have got a strange problem. May I know any solution for this.

Here is the detailed description about the problem
We have got a mainframe system and also production and development
server.

There was an application in the production server since 3 years and was
working fine. Recenlty we got into stucked up with this problem. Every
night the mainframe generates few text files and thru FTP it sents
those files to production server.

In the production server application we do have got few jobs (i.e
dotnet application) that reads this text file(s) and the data from
these text files will be stored in our sql server DB for the use of web
applications.

Now the jobs in the development server (which we are using for testing)
got creating problems like "Invalid index" and stoping the process
further. After examining the problem in respective dotnet application i
got to know the problem where it is but I am surprised to see that the
same application working fine in production server since few years.

I dont have the source code of dotnet application which is running in
the production server. But I do have source code of dot net application
that is in development server.

Here in the dot net application I am able to see the source code and it
is being written like this...the algorithm as follows.

1. Dynamically getting the connection string (i.e.
Provider=Microsoft.jet.oledb.4.0;Data source=C:\myapp;Extended
Properties=Text;)
2. Establishing oledb connection.
3. Dynamically constructing the SELECT stmt with respective txt file ex
"select * from members.txt" (here the members.txt file is from Mainframe
and stored in C:\myapp folder)
4. Using OLEDB Command object executing the about SELECT statement and
returning back to OLEDBDataReader object back to the caller.
5. In the caller function the person who written the code directly
referring values from the reader as objReader.getvalue(0),
objReader.getvalue(1)... so on.
6. Now the problem is after executing the command object in the reader
I am able to see only one column i.e objReader.getvalue(0). Its
because
the entire one line of the text file is coming in one column (but it
suppose to split in to multiple columns)
7. Its generating an exception when the code refers second column on
wards.
8. Here I donno wat is the delimeter for knowing columns in the text
file.
9. I do see few spaces between values in the text files.
10. Here my doubt is if the code is compiled like this how its running
fine in the production server.
11. Or if I wann change code in the development server how could I do
that. After I seached in internet in the while generating the
connection string in the extended properties I have to mention lie
this..

"Extended Properties=Text;HDR=No;delimited=TabDelimited" This is in
case of the text file content was delimited by tab

Where as here I am thinking that its not delimited by TAB and also
thinking that it might be delimited by no of characters example.. first
column is 15 characters and from 16th character on wards its second
column until 25th character etc.... in this case how and wat value
should I mention in the delimited property?

can any one of you enlighten me on this.

I am desperately looking for valuable suggestions.
Thanks in advance...

VJ
--
svijay
------------------------------------------------------------------------
svijay's Profile: http://www.hightechtalks.com/m628
View this thread: http://www.hightechtalks.com/t2319718

Dec 30 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Hi

I got the solution I must use schema.ini file to solve this and I need
to define the column definitions in that file.

thx to all of U
--
svijay
------------------------------------------------------------------------
svijay's Profile: http://www.hightechtalks.com/m628
View this thread: http://www.hightechtalks.com/t2319718

Dec 30 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.