/// <summary> /// 生成表数据的CSV字符串 /// </summary> /// <param name="tableName">表名</param> /// <param name="strCondition">条件</param> /// <returns>CSV字符串</returns> private string GetCSV(string tableName, string strCondition) { StringBuilder csvStr = new StringBuilder(); if (tableName == "") { return(""); //得到列名 } csvStr.Append(hidexporttitle.Value); csvStr.Append("\t\n"); List <List <string> > ll_data = Agedb.GetDataByCondition(tableName, hidexportfield.Value, strCondition); for (int i = 0; i < ll_data.Count; i++) { for (int j = 0; j < ll_data[i].Count; j++) { csvStr.Append(@"" + ll_data[i][j].ToString() + ", "); } csvStr.Remove(csvStr.Length - 1, 1); csvStr.Append("\t\n"); } return(csvStr.ToString()); }