老兄啊,能否把操作说的详细一点啊?
我的报表不是显示不出数据,而是显示的是默认的报表里的数据。
我希望的是显示动态绑定给他的DataSet里的数据。

解决方案 »

  1.   

    老兄错了:
    myConnection=new SqlConnection("server=davis;database=student;user id=sa;password=");
    myConnection.Open();
    string strSql="SELECT xm,bjs,sf,dq,xs,xxlx FROM x_hunan WHERE bjs<12"; SqlCommand myCommand=new SqlCommand();
    myCommand.Connection=myConnection;
    myCommand.CommandType=CommandType.Text;
    myCommand.CommandText=strSql; 
    SqlDataAdapter myAd=new SqlDataAdapter(strSql,myConnection);
    myAd.SelectCommand=myCommand;
    DataSet myDs=new DataSet();myAd.Fill(myDs,"x_hunan"); 
    CrystalReport1 tmprpt=new CrystalReport1()  ;  
    tmprpt.SetDataSource(myDs.tables["x_hunan"]);
    crystalReportViewer1.ReportSource=tmprpt; 这样看行不行