日期:2014-05-17 浏览次数:20388 次
respObj.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); respObj.AppendHeader("Content-Disposition", "attachment;filename=" + strFileName); string strColHeaders = "", strLstItem = ""; int i = 0; DataSet dstObj = GetDataSet(strSQL, strTableName); DataTable dtblObj = dstObj.Tables[0]; DataRow[] drowObj = dtblObj.Select(""); // strTypeID=="1" if (strTypeID == "1") { for (i = 0; i <= dtblObj.Columns.Count - 2; i++) { strColHeaders += dtblObj.Columns[i].Caption.ToString() + "\t"; } strColHeaders += dtblObj.Columns[i].Caption.ToString() + "\n"; respObj.Write(strColHeaders); foreach (DataRow drowObjTmp in drowObj) { for (i = 0; i <= dtblObj.Columns.Count - 2; i++) { strLstItem += drowObjTmp[i].ToString() + "\t"; } strLstItem += drowObjTmp[i].ToString() + "\n"; respObj.Write(strLstItem); strLstItem = ""; } }