那是因为你要打开时,他需要连接,有一个方法,可以不出现该窗口,
就是在你的CrystalReportViewer控件的ReportSource的属性暂时为空,需要显示时
给填充相应的数据集,水晶报表的setDatasource()方法设置数据集,然后把相应的reportDocument相应的控件设置到CrystalReportViewer的ReportSource属性上

解决方案 »

  1.   

    不会呀,我原来也遇到这个问题,就是这样解决的,要注意先把CrystalReportViewer控件的ReportSource的属性暂时为空,另外在把相应的reportDocument相应的控件设置到CrystalReportViewer的ReportSource属性上之前 一定要 把报表的数据源给设定正确(如数据集)你再试试,应该没有问题的
      

  2.   

    楼上说的正确。
    另外如果只针对本地,在编辑crystalReport的时候测试连接,能接通以后就没事了。
      

  3.   

    一种是用代码设置,“帮助”里面有代码,或者你可以搜索一下csdn有关“crystalreport”;另一个方法是让CrystalReportViewer控件dataset数据集中的你要显示的表的内容(象上面说的,先把表fill到dataset再把它绑到CrystalReportViewer控件)
      

  4.   

    不明白:
    "把相应的reportDocument相应的控件设置到CrystalReportViewer的ReportSource属性上"是否要指定 reportdocument.database.tables.table.logoninfo?
      

  5.   

    不是,reportDocument是一个组件,把它拖到容器(如窗体)中时,会出现一个向导,你可以在了下拉框中选择你事先建好的报表,这样,reportDocument就和报表关联上了,再把reportDocument
    对象(通过程序)绑定到reportViewer上,SetDataSource()方法也是reportDocument的
    即:reportDocument.SetDataSource(object dataSource)
      

  6.   

    還是出現一個窗口要求輸入密碼! 我暈了.
    可否就sql server的sample數據庫給個例子來. 謝謝各位了!!!
    我是這樣做的:
    private void Form1_Load(object sender, System.EventArgs e)
    {
    this.conn.ConnectionString ="user id=sa;password=hfff;data source=mssql;initial catalog=ffmis;persist security info=false";
    this.selectcmd.CommandText ="Select * from customers";
    this.selectcmd.Connection=this.conn;
    this.da.SelectCommand=this.selectcmd ;
    this.da.Fill(this.ds,"customers");
    this.crystalReport11.SetDataSource("");
    }private void button1_Click(object sender, System.EventArgs e)
    {
    this.crystalReportViewer1.ReportSource=this.crystalReport11 ;
    this.crystalReport11.SetDataSource(this.ds.Tables[0]);
    }
      

  7.   

    "把reportDocument拖到窗体中,出现一个向导,在下拉框中选择事先建好的报表"
      這一步我以做了。
      還是不行,救命啊!
      

  8.   

    string strProvider = "Server=(local);DataBase=test;UID=sa;PWD=sa";
    CrystalReport1 oCR = new CrystalReport1();Dataset1 ds = new Dataset1();
    SqlConnection MyConn = new SqlConnection(strProvider);
    MyConn.Open();string strSel = "Select * from table"
    SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,MyConn);
    MyAdapter.Fill(ds,"table");oCR.SetDataSource(ds);
    this.crystalReportViewer1.ReportSource = oCR;
      

  9.   

    只要把順序換過來就行了, 真tmd!
        this.crystalReport11.SetDataSource(this.ds.Tables[0]);
        this.crystalReportViewer1.ReportSource=this.crystalReport11 ;