你是不是一行行地write的?
把你要write的语句用分号隔开,
在一个string中,一次write试试

解决方案 »

  1.   

    Response.Write ();括號裡寫要打印的內容;
      

  2.   

    把aspx页面中的<%Response.Write ()%>换成<%#test()%>,在把Response.Write()放进后台代码aspx.cs中的test()方法中。
      

  3.   

    Response.Write("要输出的字符串");
      

  4.   

    大小写问题。不过也不一定非这样写嘛~还有很多方法。这样写好象不是最快的~
    这样写。然后从文件里读。比你的方法在第二次访问的时候快无数倍
    private void HotOfferGenerateSingleFile(DataSet tmpds,int pageSize ,int currPage,string newFilePath,DateTime today,string FileName,string frontFilePath,string type,string imgPath)
    {
    StreamWriter sw=new StreamWriter(newFilePath,false,Encoding.UTF8 );
    HotOfferInsertTop(sw,today,FileName,type,imgPath);

    if (tmpds.Tables[type].Rows.Count==0)
    {
    HotOfferInsertBottom(sw,pageSize,currPage,tmpds.Tables[type].Rows.Count,frontFilePath);
    sw.Close();
    return;
    }
    int startRow=(currPage-1)*pageSize;
    int endRow=(startRow+pageSize);
    if (endRow>tmpds.Tables[type].Rows.Count)
    {
    endRow=tmpds.Tables[type].Rows.Count;
    }

    bool IsNewTable=false;
    IsNewTable=false;
    DataRow chipRow;
    DataRow parentRow;
    int companyID;
    int rowi=0;
    DataRelation relation=tmpds.Relations[0];
    companyID=0; for (int i=startRow;i<endRow;i++) 
    {
    rowi++;
    chipRow=tmpds.Tables[type].Rows[i];
    if ((int)chipRow[0]!=companyID )
    {
    if (companyID!=0)
    {
    sw.WriteLine ("</table>");
    sw.WriteLine("</table>");
    sw.WriteLine("<table width='100%'><tr><td colSpan=7 height='30' valign='top' background='../../img/C-23.gif'>&nbsp;</td></tr></table>");
    }

    IsNewTable=true;
    companyID=(int)chipRow[0];
    parentRow=chipRow.GetParentRow(relation);


    sw.WriteLine("<table class='buyTableParent' cellSpacing='1' cellPadding='0' width='98%' align='center' ID='Table1'>");
    sw.WriteLine("<tr><td  colSpan='10'>");
    if (parentRow["url"].ToString()!="" && parentRow["url"].ToString().ToLower()!="http://")
    {
    sw.WriteLine("<A class=compname  href='" + parentRow["url"].ToString() + "' target=_blank >");
    }
    sw.WriteLine("<font color=#cc0033>");
    //这里因语言不同而不同
    if (parentRow[currLangCol_browser].ToString()!="")
    {sw.WriteLine(parentRow[currLangCol_browser].ToString());}
    else
    {sw.WriteLine(parentRow[1].ToString());} 
    sw.WriteLine("</font>");
    if (parentRow["url"].ToString()!="" && parentRow["url"].ToString().ToLower()!="http://")
    {
    sw.WriteLine("</A>");
    }
    sw.WriteLine("<strong>");
    sw.WriteLine(parentRow[10].ToString());
    sw.WriteLine("</strong>");
    sw.WriteLine("&nbsp;&nbsp;&nbsp;<strong>" +updateName[currLangType] + @":</strong>" + String.Format("{0:d}",chipRow[8]));
    sw.WriteLine("<BR>");
    string linkman="";

    if (parentRow[currLangCol_LinkMan_Browser].ToString()!="")
    linkman=parentRow[currLangCol_LinkMan_Browser].ToString();
    else
    linkman=parentRow[11].ToString(); sw.WriteLine("<strong>" +linkManName[currLangType] + @":</strong>"+linkman );
    sw.WriteLine("<strong>" +phoneName[currLangType] + @":</strong>"+parentRow[12].ToString() );
    sw.WriteLine("<strong>" +faxName[currLangType] + @":</strong>"+parentRow[4].ToString() );
    sw.WriteLine("</td>");
    sw.WriteLine("</tr>");
    sw.WriteLine("</table>");
    sw.WriteLine("<table class='buyTable' width='98%' cellpadding='0' cellspacing='1' align='center' ID='Table2'>");
    sw.WriteLine("<tr>");
    sw.WriteLine("<td>");
    sw.WriteLine("<table cellSpacing='0' cellPadding='0' width='100%' align='center' border='0' ID='Table3'>");
    sw.WriteLine("<tr class='buyTableTitle'>");
    sw.WriteLine("<td width='57'>" +partName[currLangType] + @"</td>");
    sw.WriteLine("<td width='65'>" +QuantityName[currLangType] + @"</td>");
    sw.WriteLine("<td width='65'>" +priceName[currLangType] + @"($)</td>");

    sw.WriteLine("<td width='65'>" +mfgName[currLangType] + @"</td>");
    sw.WriteLine("<td width='65'>" +dcName[currLangType] + @"</td>");
    sw.WriteLine("<td width='69'>" +descriptionName[currLangType] + @"</td>");
    //sw.WriteLine("<td width='69'>更新日期</td>");
    sw.WriteLine("</tr>");
    rowi=0;
    }
    else { IsNewTable=false;}  if (rowi%2==0)
    {sw.WriteLine("<tr class='buyGeneralTd'>");}
    else
    {sw.WriteLine("<tr class='buyIntervalTd'>");} sw.WriteLine("<td width='15%'><A href='SendMessage.aspx?SelectedChipID=" +chipRow[1].ToString() +"' target='main' >" + chipRow[2].ToString() + "</A>");
    if (chipRow[9].ToString() != "")
    {
    sw.WriteLine("<A href='" +chipRow[9].ToString() + "'  target=_blank><img src='../../img/partnodata.gif' border='0'></A>");
    }
    sw.WriteLine("</td>");
    sw.WriteLine("<td width='10%'>" + chipRow[4].ToString() + "</td>");
    sw.WriteLine("<td width='10%'>" + chipRow[5].ToString() + "</td>");
    sw.WriteLine("<td width='10%'>" + chipRow[3].ToString() + "</td>"); sw.WriteLine("<td width='7%'>" + chipRow[6].ToString() + "</td>");
    sw.WriteLine("<td width='11%'>" + chipRow[7] .ToString() + "</td>");
    //sw.WriteLine("<td width='10%'>" + String.Format("{0:d}",chipRow[8]) + "</td>");
    sw.WriteLine("</tr>");
    }
    sw.WriteLine("</table>");
    sw.WriteLine("</td>");
    sw.WriteLine("</tr>");
    sw.WriteLine("</table>"); HotOfferInsertBottom(sw,pageSize,currPage,tmpds.Tables[type].Rows.Count,frontFilePath);
    sw.Close();
    }