Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I open/change a textfile to a recordset

Status
Not open for further replies.

mwash

Programmer
Apr 24, 2003
4
US
I am a relativley new VBScript programmer and I need to find out how to use a textfile as a recordet OR find a way to maneuver through the lines(records) in a text file...like movefirst, movenext, etc...

Any help will be greatly appreciated!

Thnx
 
Thanks, I rely heavily on DEV GURU for a lot of information, BUT I need to convert a text file to a recordset so that I can perform a "select" statement on it. I have not been able to find a way to do that on a textfile, in this case it is a CSV file...so I still need more help...that I can't find anything about this conversion @ DevGuru, or anywhere else, yet.
 
from my understanding a recordset is returned in the format of rows and columns. i can see how this can be accompished with ado when reading databases or csv files etc.
as in csv stands for comma seperated values, if am not mistaken.

so my question would be
in your txt file how have you delimited the information??

regards,
von moyle
 
ok, have done a little reading
you can use ado v2.5 which uses a new ms tech called "distributed author versioning"
which equates to WebDAV in IIS terms.
anyway it allows you to manip data in a non-database data store( your text file i guess)

you can use an ADO.Record object which can represent a folder and then you go through this folder and it gives you a record set of the files in that folder.

there is also a stream object but lookin at it all it does is allow you to read a text file using an ADO connection. the info i have got only shows how to read the file as a text stream,,,,so thats the best ive got

i would convert you txt file to csv format and work on it that way

von moyla
 
WebDAV is a technology for reading/updating files over HTTP. Not sure how that helps here. I assume you have the ability to read the CSV file locally or via a file share.

I'm not sure about "perform a select statement on" an ADO Recordset. I was pretty sure ADO doesn't contain a SQL parser/processor - though it can create SQL to go against a data source. I'd be glad to hear more about this though. I'm pretty sure SQL is processed by a database engine, not ADO itself.

What I *know* can be done is two things:
[ul][li]If you only need read access to the CSV data... you can use the Microsoft Tabular Data Control (TDC). This was designed for client-side web use in IE but can be used otherwise. It can read CSV and other delimited-text files to load tabular data. TDC exposes a Recordset property that can be treated almost exactly like a real ADO Recordset. The TDC Recordset has most of the same properties and methods. This means sorting and filtering can be done, MoveFirst/MoveNext, etc. But TDC cannot update rows to disk.
[li]The Jet database engine supports a "text driver" with these abilities and perhaps more. I don't have recent experience with it, but it might offer you a solution.[/ul]
So I'd look both of these up in the SDKs if you have them, or MSDN Library Online if you don't.

 
mrmovie, thanks for reaserching this for me. I do have a CSV file that I created. I actually receive a text file and produce 2 CSV files which now I need to "relate" these two files based on a common unique identifier. I still don't know the best way to do this. I don't know if I could or should try to load either or both of these files into an access database or sql table or some other format, so that I can sort and perform queries against...
 
dilettante, thanks for the advice. I am going to look further into both of these possiblilties. I will let you know of my progress...
 
As Dilettante eludes, the JET engine has an ISAM driver for accessing text data sources. Samples can be found at


Microsoft also has an ODBC driver for Text files, the usage is very similar to the JET ISAM. Don't have a URL handy, search for Microsoft Text Driver.



Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top