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...
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??
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
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.