你是不是一行行地write的?
把你要write的语句用分号隔开,
在一个string中,一次write试试
把你要write的语句用分号隔开,
在一个string中,一次write试试
解决方案 »
- GridView 模板列中放了 微软自带的 FileUpload控件
- 报where 附近有语法错误,那位帮助解决一下
- C#动态生成控件问题
- Url重写能不能用在其他主机的网址?
- 无限分类中如何把树型结构绑定在下拉框之下显示?
- 如何设置,让.net在整个网站都润许输入脚本
- 验证控件问题怎么解决?
- 动态创建控件,不是每次都生成马?为什么可以自动保持viewstate?
- textbox里的值写到sqlserver中写不全。why
- 关于ASP.net向SQL server数据库插入记录的问题
- ASP.NET中如何获得浏览者的端口号
- 我以前的代码拷贝到另外一台电脑上的时候,运行的时候发生错误:无法在web服务器上启动调试????
这样写。然后从文件里读。比你的方法在第二次访问的时候快无数倍
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'> </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(" <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();
}