using (StreamWriter sw = new StreamWriter("TestFile.txt")) 
{
    // Add some text to the file.
    //遍历dataSet11, 
    foreach(System.Data.DataRow row in dataSet11.Tables[0].Rows)
    {
    //遍历当前行的每一列, 如果不为空则输出字段值,否则输出","
        for(int  col=0;col<dataSet11.Tables[0].Columns.Count;col++)
        {
   if(!(row[col] is System.DBNull))
  {
sw.Write(row[col].ToString());
  }
   sw.Write(",");
        }
        sw.WriteLine("");
        }
}