Wednesday, April 09, 2008 5:03 AM
In the past I have found the "Microsoft Text Driver" a great answer to some programming jobs.
(For those who haven't used it: This is a driver that connects directly to flat files (comma separated or whatever) and allows them to be handled like a database, including SQL queries and writing data. The relations etc. are defined in a file called "schema.ini".)
I'm currently looking at a job where LINQ against flat files would be a very good approach.
(There is only ever one user, if the data were imported into a dB it would likely be dumped again immediately...)
My search has not shown anybody doing this sort of thing with LINQ.
Is there an existing way to do this?
Friday, April 11, 2008 7:42 AM
As far as I know, LINQ can query some .Net containers and collections, such as list generic class, please check the code snippet below.Code Snippet
var aList = new List<FieldContainer>
var r1 = from a in aList
FieldContainer value1 = null;
foreach (var q1 in r1)
value1 = q1;Code Snippet
public class FieldContainer
private string text;
public string Text
this.text = value;
public FieldContainer(string text)
Text = text;
And you put the plain text to the list which wrapped by a custom class type.
Friday, May 09, 2008 5:35 AM
No that's not what I'm thinking about.
I'd like to link up to a set of files, described in a scema.ini and treated as if they were a relational database.
It was available in past MS database technologies and extremely useful (where it fits).
Friday, May 09, 2008 5:52 PM
This might do the trick:
Monday, May 12, 2008 11:34 PM
I have just completed some tests of LINQToCSV.
It does indeed do the job.
The project was done using SQL Server, so I took some parts of it, made them into csv's, wrote a test app. to exercise them (C#) including joins and some simple LINQ queries. When that worked I converted it into VB 9 and ran it there. (There are a few differences but it all worked. GREAT.)
(I see the article was published 2 days after I asked the question. Serendipity?)
I'm impressed that you have the time to check these fora. Thanks.