個為幫忙看看啦﹗﹗這個問題困擾我好多天了
.net中只能通過Response.Write顯示數據成報表樣式

解决方案 »

  1.   

    那你可以通过Response.Write循环输出HTML不就行了吗
    如StringBuilder sb = new StringBuilder();
    sb.AppendLine("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
    for (int i=0; i<3; i++)
    {
       sb.AppendLine("<tr>");
       sb.AppendLine("<td>");
       sb.AppendLine(i.ToString());
       sb.AppendLine("</td>");
       sb.AppendLine("</tr>");}
    sb.AppendLine("</table>");Response.Write(sb.ToString());
      

  2.   

    样的呀,循环查询出来的DataTable呀
      

  3.   

    我寫到下面就寫不出來了﹐如何繼續
     protected void btnSee_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            ds = (new EXPENSE()).SelectAllEXPENSE(); 
            
                Response.Write(" " +
                   "  <table id='td' border='1' cellspacing='1' cellpanding='1' style='width:556px;height:66px;text-align:center;' > " +
                   "  <tr>    " +
                   "  <td rowspan='2' style='width:100px'>          " +
                   "  鋪號    " +
                   "  </td>   " +
                   "  <td colspan=4' style='text-align:center'>     " +
                   "  2008 年3月收入  " +
                   "  </td>   " +
                   "  <td colspan='4' style='text-align:center'>    " +
                   "  2008年4月收入  " +
                   "  </td>   " +
                   "  <td rowspan='2' style='width:100px'>          " +
                   "   合計          " +
                   "  </td>   " +
                   "  </tr>    " +
                    "  <tr>    " +
                   "  <td  style='width:100px: height:21px'>          " +
                   "  租金    " +
                   "  </td>   " +
                   "  <td  style='width:100px;height:21px'>     " +
                   "  清潔費  " +
                   "  </td>   " +
                   "  <td  style='width:100px;height:21px'>    " +
                   "  管理費  " +
                   "  </td>   " +
                   "  <td style='width:100px;height:21px'>          " +
                   "   小計          " +
                   "  </td>   " +
                   "  <td  style='width:100px;height:21px'>     " +
                   "  租金  " +
                   "  </td>   " +
                   "  <td  style='width:100px;height:21px'>    " +
                   "  垃圾  " +
                   "  </td>   " +
                   "  <td style='width:100px;height:21px'>          " +
                   "   水費          " +
                   "  </td>   " +
                    "  <td style='width:100px;height:21px'>          " +
                   "   管理          " +
                   "  </td>   " +
                   "  </tr>    ");
            
                //for (int i = 0; i <= ds.Tables["EXPENSE"].Rows.Count -1; i++)
                //{
                //    for (int j = 0; j <=ds.Tables["EXPENSE"].Columns.Count -1 ; j++)
                //    {
                //        //int k = 1;
                //        TextBox1.Text=ds.Tables["EXPENSE"].Rows(i)(j);
                //        Response.Write(ss);
                //    }
                //}
        }