用pull 模式在Form中做了水晶报表,用的是dataset做的。
CrystalReport1 c1 = new CrystalReport1();            c1.SetDataSource(wenDataSet1);            crystalReportViewer1.ReportSource = c1;     
    
现在想添加条件查询,按照textbox的条件来执行查询。代码应该怎样写。或者用另外模式。但是小菜不知怎样做。另请大神出手

解决方案 »

  1.   

    wenDataSet1.Table[0].Select("name='"+zhangshan+"'");
      

  2.   


    比如我是要textbox1.text 就是wenDataSet1.Table[0].Select("name='"+textbox1.text+"'"); 是吧 但是如果要多个的话呢? 比如说要名字、日期、ID 这样多个的。用交叉查询。
      

  3.   


    后面跟 And 就可以了,,跟sql差不多
      

  4.   


    不行呢,我试过不行。 你看看代码看能不能帮我改改,谢了
    try
                {
                    this.tabTestTableAdapter.WEN1(this.wenDataSet1.TabTest);
                }
                catch (System.Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }
                tabTestTableAdapter.WEN1(wenDataSet1.TabTest);//,int.Parse(textBox1.Text));            CrystalReport1 c1 = new CrystalReport1();            
                c1.SetDataSource(wenDataSet1);            crystalReportViewer1.ReportSource = c1;