那是因为你要打开时,他需要连接,有一个方法,可以不出现该窗口,
就是在你的CrystalReportViewer控件的ReportSource的属性暂时为空,需要显示时
给填充相应的数据集,水晶报表的setDatasource()方法设置数据集,然后把相应的reportDocument相应的控件设置到CrystalReportViewer的ReportSource属性上
就是在你的CrystalReportViewer控件的ReportSource的属性暂时为空,需要显示时
给填充相应的数据集,水晶报表的setDatasource()方法设置数据集,然后把相应的reportDocument相应的控件设置到CrystalReportViewer的ReportSource属性上
另外如果只针对本地,在编辑crystalReport的时候测试连接,能接通以后就没事了。
"把相应的reportDocument相应的控件设置到CrystalReportViewer的ReportSource属性上"是否要指定 reportdocument.database.tables.table.logoninfo?
对象(通过程序)绑定到reportViewer上,SetDataSource()方法也是reportDocument的
即:reportDocument.SetDataSource(object dataSource)
可否就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]);
}
這一步我以做了。
還是不行,救命啊!
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;
this.crystalReport11.SetDataSource(this.ds.Tables[0]);
this.crystalReportViewer1.ReportSource=this.crystalReport11 ;