Parsing a text file

J

JJ

For a second there I thought you'd answered my prayers. Unfortunately I need
to test the trial system on a full size text file, so using the free
component with its limitations won't do the job.

Thanks though.

I'm actually there with the importing of the text - just not there with the
manipulation of it. Because it's so large, I'm at a loss as to how to keep
hold of the datatable so that I can sort/page it. Not sure whether things
like viewstate could hold such a large item...?
JJ


"Limitations
GemBox.Spreadsheet Free delivers the same performance and set of features as
the Professional version. However, the following limitations are imposed:

Maximum number of rows per sheet is 150.
Maximum number of sheets per workbook is 5.

The above limitations are enforced during writing or reading XLS or CSV
files."
 
D

David

Here is how I do this in VBScript. You can do similar in .NET

It works, it will read txt and csv files just like a database. You can query
it.

set conn=CreateObject("adodb.connection")
conn.Open "DRIVER={Microsoft Text Driver (*.txt;
*.csv)};DefaultDir=/WorkingDir;"

set rs=CreateObject("adodb.recordset")
strSQL = "SELECT * FROM [MyFileName.csv] "
rs.Open strSQL, conn, 3, 3

if not rs.EOF then
do while not rs.EOF

'Do what you need to do with the data.

rs.movenext
loop
end if

'Close your connection and recordset


This is in VBScript. I have not done it yet it .NET though that will be
trivial. It will save all the effort of parsing the file to get what you
want. You can set up the ODBC parameters to however the data should be
parsed (delimited).

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top