Re: DataTable efficiency
Sébastien Lorion <[email protected]> Fri, 23 Nov 2007 08:29:25 +0800
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
You can create the DataTable before hand and then use the Load method (the CsvReader implement IDataReader). S=E9bastien On 11/23/07, Alan Baljeu <[email protected]> wrote: > I like it in concept, but... Currently I'm using the ODBC driver to read = these files. It > uses schema.ini to convert specified columns to bool or int. Your code j= ust gives me > strings. Have you any suggestion on how I might adapt the CSV reader to = parse columns > according to a schema? Initially I imagine putting this stuff into DataT= ables because > anything else will require much code conversion. > > > -----Original Message----- > > From: Discussion relating to the specifics of the C# and > > Managed C++ languages [mailto:[email protected]] > > On Behalf Of S=E9bastien Lorion > > Sent: Wednesday, November 21, 2007 11:09 PM > > To: [email protected] > > Subject: Re: [DOTNET-CX] DataTable efficiency > > > > You may want to take a look at my CSV reader found on Code Project: > > > > http://www.codeproject.com/cs/database/CsvReader.asp > > > > Sebastien > > > > On 11/21/07, Alan Baljeu <[email protected]> wrote: > > > My application uses a largish readonly database (CSV files, > > actually) > > > consisting of several tables. These tables are accessed somewhat > > > frequently, and I want to make this as efficient as > > possible. I'm currently using plain DataTable objects > > produced by OdbcAdapters and > > > queries. These tables are cached so I'm just searching > > in-memory tables after that. My > > > queries look like "SELECT * FROM [{0}]" and occasionally > > "SELECT * FROM [{0}] where [{1}] =3D > > > '{2}'". I'm thinking of splitting the latter into just > > table.Select("colname =3D value"). > > > > > > I have a nagging suspicion that the DataTable structure isn't > > > super-efficient, or that certain ways of using it are > > effcient while others aren't. > > > > > > Is this so? Are there certain things I should avoid? Do you > > > recommend a certain style for efficient access? Is there a > > better approach that DataTable? > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > This list is hosted by DevelopMentor(R) http://www.develop.com > > > > > > View archives and manage your subscription(s) at > > > http://discuss.develop.com > > > > > > > > > -- > > S=E9bastien > > www.sebastienlorion.com > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > This list is hosted by DevelopMentor(R) http://www.develop.com > > > > View archives and manage your subscription(s) at > > http://discuss.develop.com > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > This list is hosted by DevelopMentor(R) http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.c= om > --=20 S=E9bastien www.sebastienlorion.com =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This list is hosted by DevelopMentor=AE http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com