下面用Repeater
<asp:Repeater id="rp1" runat="server">
<ItemTemplate>
<HeaderTemplate>
<table width="760" height="22" border="0" align="center" cellpadding="3" cellspacing="1">
</HeaderTemplate>
<tr bgcolor="#8089d2">
<td height="24" colspan="2"><b class="list"><font color="#ffffff">职位名称:<%# DataBinder.Eval(Container.DataItem,"TB_weiname")%></font></b></td>
</tr>
<tr bgcolor="#eeeeee">
<td width="296" height="22">工作地点:<%# DataBinder.Eval(Container.DataItem,"TB_site")%></td>
<td width="296" height="22">工作性质:<%# DataBinder.Eval(Container.DataItem,"TB_kind")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td height="22">性 别:<%# DataBinder.Eval(Container.DataItem,"TB_sex")%></td>
<td>年 龄:<%# DataBinder.Eval(Container.DataItem,"TB_agerequest")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td height="22">工作经验:<%# DataBinder.Eval(Container.DataItem,"TB_experience")%></td>
<td>学 历:<%# DataBinder.Eval(Container.DataItem,"TB_edu")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td height="22">外语语种:<%# DataBinder.Eval(Container.DataItem,"TB_language")%></td>
<td>要求人数:<%# DataBinder.Eval(Container.DataItem,"TB_amount")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td height="22">月薪范围:<%# DataBinder.Eval(Container.DataItem,"TB_qian")%></td>
<td height="22">截止日期:<%# DataBinder.Eval(Container.DataItem,"TB_time")%>
</td>
</tr>
<tr bgcolor="#eeeeee">
<td colspan="2">职位介绍:<%# DataBinder.Eval(Container.DataItem,"TB_yao")%></td>
</tr>
<tr align="center" bgcolor="#eeeeee">
<td height="30" colspan="2"><a href="shenqing.jsp?cid=9186&amp;zid=9333" target="_blank"></a>
<input type="button" name="Submit" value="申请该工作" onClick="window.open('shenqing.jsp?cid=9186&amp;zid=9333','','')"></td>
</tr>
<tr align="center">
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
--------------------------------------------------------
后台这样写:
private void Page_Load(object sender, System.EventArgs e)
{
                  SqlDataAdapter da=objXSqlClient.CreateDataAdapter("select * from TB_Findman where TB_Findman.TB_cid="+Request.QueryString["id"]);
DataSet ds=new DataSet();
da.Fill(ds);
rp1.DataSource=ds.Tables["TB_Findman"];
rp1.DataBind();
                   }
----------------------------------------------
我就不明白,为啥编译没错,但是就是没数据能读出来呢?

解决方案 »

  1.   

    select * from TB_Findman where TB_Findman.TB_cid="+Request.QueryString["id"]);你的这个查询一定有数据吗?rp1.DataSource=ds.Tables[0];  //改成0试试
    rp1.DataBind();
      

  2.   

    ds.Tables["TB_Findman"] // maybe err ! ds.Tables["TB_Findman"] = null ;
      

  3.   

    select * from TB_Findman where TB_Findman.TB_cid="+Request.QueryString["id"]);
    查询了,有报错,但是不知道具体怎么修改?
    在"="附近有错,哎,我在另一个程序写就没有问题,为啥这就有呢?
      

  4.   

    这样写:"select * from TB_Findman where TB_Findman.TB_cid="+Request.QueryString["id"]------------------------------------------
    服务器: 消息 170,级别 15,状态 1,行 1
    第 1 行: '+' 附近有语法错误。
      

  5.   

    "select * from TB_Findman where TB_Findman.TB_cid=" + Request.QueryString["id"].ToString()
    注意空格,还不行的话,用这样看看
    "select * from TB_Findman where TB_Findman.TB_cid='" + Request.QueryString["id"].ToString() + "'";
      

  6.   

    rp1.DataSource=ds.Tables[0];  //改成0试试//这样试成功了,但不知道原因何在?请教!!!!!!!
    rp1.DataBind();
      

  7.   

    DataAdapter在填充DataSet的时候,是按照"Table1"、"Table2"的顺序依次给DataTable命名的。