From: Rich on 5 Feb 2010 14:35 Here is what I mean by learning curve: > .....learning curve? It should be about as simple as TextParserAdapter parser = new textparseradapter(@"<path>\SpaceDelimFile.txt"); parser.ColumnDelimiter = new char[] { ' ' }; DataTable dt = parser.GetDataTable(); < I compiled GenericParsing, I added a reference to my project to the GenericParsing library, and also added a using directive -- using GenericParsing But I do not get TextParserAdapter to show up in the intellisense and if I just type it - VS(2008) complains. Is it because GenericParsing is from VS2003? How do Implement this in my (VS2008 C#) project? Thanks
From: Rich on 5 Feb 2010 17:25 Well, I tried the following, but VS complained at the DataTable part. In the demo project I did not see any GetDataTable() methods. GenericParsing.GenericParser parser = new GenericParsing.GenericParser(s1); DataTable dt = parser.getdatatable(); "Jeff Johnson" wrote: > "Rich" <Rich(a)discussions.microsoft.com> wrote in message > news:0448AEE2-5E52-4228-B5A2-581206EB802A(a)microsoft.com... > > >I started experimenting with this sample project. I noticed that stream > > reader is being used here, along with a creation of a schema.ini file like > > the Jet technique. It looks to me like the Jet technique wraps up all of > > its > > coding to a one liner - where the Jet underlying code is probably simlar > > to > > the code being used in this sample. And I guess the benefit with the code > > in > > this sample is that can be modified where the Jet code can't. > > > > The downside with this sample - for me - is the learning curve. I will > > have > > to study this a bit. And then once I compile the class I would have to > > reference it - adding a dependency to my project. > > > > It looks - for the time being - I will resign myself to my elementary > > usage > > of StreamReader. The Jet technique would be nice because it is a one > > liner, > > but alas! it does not seem to support a space as a delimiter. > > ....learning curve? It should be about as simple as > > TextParserAdapter parser = new > TextParserAdapter(@"<path>\SpaceDelimFile.txt"); > parser.ColumnDelimiter = new char[] { ' ' }; > > DataTable dt = parser.GetDataTable(); > > And then you just work with the data in the DataTable like you would with > data from any other data source. Now I've made a lot of modifications to > that library over time, but I think the code I have right there should work > out-of-the-box. > > > . >
From: Jeff Johnson on 8 Feb 2010 13:40 "Rich" <Rich(a)discussions.microsoft.com> wrote in message news:CBB30EFA-1E46-4180-B969-90E134B44C5E(a)microsoft.com... > Yay! I got it work -- turns out that my text file with the 52000 rows was > this type: > > "abc" "def" "ghi" "jkl" > "abc" "def" "ghi" "jkl" > "abc" "def" "ghi" "jkl" > ... > > with double quotes surrounding the text. It must have been generated with > VBA. Anyway, the streamreader in my original routine will read the double > quotes OK, I was just doing a .Replace(..."\"","") for each piece of data. > Once I understand the workings of GenericParser I could probably add a > .Replace to it (somewhere). parser.TextQualifier = '"' // <-- apostrophe quotation-mark apostrophe
First
|
Prev
|
Pages: 1 2 Prev: I need some help converting this to C++ Next: MMC 3.0 Auto Select ScopeNode |