Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dotnetpro database performance contest
Message
De
14/05/2007 16:46:50
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
12/05/2007 23:48:44
Markus Winhard
Lauton Software GmbH
Nürnberg, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
VFP Compiler for .NET
Divers
Thread ID:
01224231
Message ID:
01225379
Vues:
15
>Hi Cetin,
>
>>.Net doesn't need to read it line by line using a filestream. It could use a CSV provider
>
>I'm quite sure you have way more .NET knowledge than me. I'd really like to see if a CSV provider is really faster than using a file stream. Could you show me some sample code?
>
>TIA,
>
>Markus

As I promised here is a sample:
using System;
using System.Data;
using System.Data.OleDb;
using System.IO;

class test
{
 static void Main()
 {
   OleDbConnection con = new OleDbConnection();
   con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"+
     "Data Source=c:\\temp\\;Extended Properties=\"text;HDR=Yes;FMT=Delimited\"";
   OleDbCommand cmd = new OleDbCommand("select * from myCSV.csv",con);
   con.Open();
   OleDbDataReader rdr = cmd.ExecuteReader();

   int row=1;
   while (rdr.Read())
   {
     Console.WriteLine("Row #{0}",row++);
     for(int i=0;i<rdr.FieldCount;i++)
     {
       Console.WriteLine("\t{0}\t:{1}",rdr.GetName(i), rdr[i]);
     }
   }
   rdr.Close();
   con.Close();
 } 
}
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform