I am almost 100% positive I cannot do what I want with this particular piece of code but I thought I would ask for either A)Suggestions on an alternative approach of B)Someone to say "Well actually you could......".
Basically I am writing a class/program to allow you to interrogate a file structure using SQL. I don't know if there are already programs out there that already do that but we where discussing at work how nice it would be if we could do something like that. So I wrote the following:
Now I foolishly thought that it would be quite easy to run a Select query on one Datatable stored in memory and pop the results into another. Without having to write either to a database. Turns out their isn't....or at least none that I could find. So I am looking for alternatives or a something to say I was wrong about being wrong.
I am not looking for full code or solutions just a nudge in the write direction. Otherwise I am actually quite pleased with this simple little application.
Thanks for all the help and apologies if this is in the wrong place.
Kevin
Basically I am writing a class/program to allow you to interrogate a file structure using SQL. I don't know if there are already programs out there that already do that but we where discussing at work how nice it would be if we could do something like that. So I wrote the following:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace FileQuery { class FileQueryer { private System.Data.DataTable _source; private System.Data.DataTable _results; public void FileQuery() { _source = new System.Data.DataTable(); _results = new System.Data.DataTable(); } public System.Data.DataTable DisplayResult() { return this._results; } public void ReadDirectory(String root) { DirectoryInfo files = new DirectoryInfo(root); foreach (FileInfo file in files.GetFiles()) { _source.Rows.Add(file.FullName, file.Extension, file.Name, file.Length); } } public void QueryDirectory(String query) { //Select from _source into _results } } }
Now I foolishly thought that it would be quite easy to run a Select query on one Datatable stored in memory and pop the results into another. Without having to write either to a database. Turns out their isn't....or at least none that I could find. So I am looking for alternatives or a something to say I was wrong about being wrong.
I am not looking for full code or solutions just a nudge in the write direction. Otherwise I am actually quite pleased with this simple little application.
Thanks for all the help and apologies if this is in the wrong place.
Kevin