我现在碰到这么一个问题.这是前台代码.
<table style="width: 100%; left: 0px; position: absolute; top: 0px;" border="0" >
<tr>
<td style="height: 18px"><table id="table1" runat="server" border="0" width="100%" class="style2003">
<tr><td>工作编号<asp:TextBox ID="tbJobNo" runat="server" Width="150px" BackColor="lightYellow"/><asp:Button ID="btnLook" runat="server" Width="50px" Height="20px" Text="检索" OnClick="btnLook_Click"/><input type="hidden" id="hiddenFlag" runat="server" /></td></tr>
</table>
</td>
</tr>
<tr>
<td>
<rsweb:ReportViewer ID="ReportViewer1"  runat="server" Font-Names="Verdana" Font-Size="8pt"   Height="600px" Width="100%">
<LocalReport ReportPath="MemberPages\CustomerMng\Report1.rdlc">
 <DataSources>
<rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet3_view_JobSeYw" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FreightBusinessConnectionString %>"
                        SelectCommand=""></asp:SqlDataSource>
                    </td>
            </tr>
            <tr>
                <td style="height: 21px">
                </td>
            </tr>
        </table>

解决方案 »

  1.   

    后台代码如下.
     protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
               sql1 = "select JobNo,DeptName,JobType,InputDate,AttnName,Tele,Fax,EMail,KHBH,Sealine,DiscPort,DeliPort,TranPort,AgentName,Vessel,Voy,Etd,Atd,BookingDate,BookingMan,BillNo,HouseNo,LoadMode,Weight,CBM,GoodsNum,GoodsName,Package,GoodsSize,MBLPayType,MBLPayDesc,HaveHBl,HBLPayType,HBLPayDesc,LoadDate,ValiDate,TradeMode,Direction,Mark,Descript,Class,UNNo,IMDGCode,KHOPNote,ShipCodeH,ShipHouse,ConsCodeH,ConsHouse,NotiCodeH,NotiHouse from view_JobSeYw where JobNo='SSEN50702'";
               SqlDataSource sds =(SqlDataSource)Page.FindControl("SqlDataSource1");
               sds.SelectCommand = sql1;
             
              
             }
        }
        protected void btnLook_Click(object sender, EventArgs e)
        {
         
            sql1 = "select JobNo,DeptName,JobType,InputDate,AttnName,Tele,Fax,EMail,KHBH,Sealine,DiscPort,DeliPort,TranPort,AgentName,Vessel,Voy,Etd,Atd,BookingDate,BookingMan,BillNo,HouseNo,LoadMode,Weight,CBM,GoodsNum,GoodsName,Package,GoodsSize,MBLPayType,MBLPayDesc,HaveHBl,HBLPayType,HBLPayDesc,LoadDate,ValiDate,TradeMode,Direction,Mark,Descript,Class,UNNo,IMDGCode,KHOPNote,ShipCodeH,ShipHouse,ConsCodeH,ConsHouse,NotiCodeH,NotiHouse from view_JobSeYw where JobNo='SSEN50548'"; 
            SqlDataSource1.SelectCommand = sql1;
         }
      

  2.   

    我现在碰到的问题是,当点击查询后.报表里的内容不随查询的条件而刷新.如果是一般的页面我只要切换SqlDataSource.SqlCommand的连接字符串就可以根据不同的条件显示相应的内容.
    希望大家帮我看看。
      

  3.   

    你看看是不是事件丢了:InitializeComponent中有没有this.Load += new System.EventHandler(this.Page_Load);和有没有this.btnLook.Click += new System.EventHandler(this.btnLook_Click);如果没有就加入这段代码
      

  4.   

    不是事件丢了。vs2005不需要在后台添加事件的....可能是<rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet3_view_JobSeYw" />的问题.
    DataSet3_view_JobSeYw是网络数据源.如果我不加任何条件出来的总是第一条.如果是网络数据源的问题那么我怎么才能够绑定自己检索后的dataset呢。
      

  5.   

    此问题,经过自己的摸索终于解决了.哈哈...不是事件的丢失问题.是没有刷新的问题....加上
    ReportViewer1.LocalReport.Refresh();这句话就可以解决此问题了。......