"C'era una volta un dataset" - svolgimento...

...dopo parecchio silenzio....

se può servire a qualcuno ecco una routine c# che "svolge" un dataset di qualsiasi dimensione e ne scrive il contenuto in un file testuale.

 

public void WriteToTxt(DataSet myDataset, string pathFileName, string fileNameStartWith)

{

    string file = String.Format("{0}{1}{2}.txt", pathFileName, fileNameStartWith, DateTime.Now.ToString("dd-MM-yyyy_HH.mm.ss"));

    TextWriter tw = File.CreateText(file);

    foreach (DataTable dt in myDataset.Tables)

   {

       foreach (DataRow dr in dt.Rows)

      {

          for (int i=0; i<=(dr.ItemArray.Length-1); i++) tw.Write(dr[i].ToString());

          tw.WriteLine();

      }

}

tw.Close();

}

 

posted @ giovedì 10 marzo 2005 03:04

Print
Comments have been closed on this topic.
«aprile»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011