..
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;
using CrystalDecisions.CrystalReports.Engine;
...
事件处理:
string exec="select * from userpwd";
this.sqlConnection1.Open();
this.sqlDataAdapter1.SelectCommand.CommandText=exec;
this.sqlDataAdapter1.Fill(this.userpwdDataSet1,"userpwd");
this.dataGrid1.DataSource=this.userpwdDataSet1;
this.dataGrid1.DataMember="userpwd";
//this.dataGrid1.DataBindings;
CrystalReport1 cr1=new CrystalReport1();
cr1.SetDataSource(this.userpwdDataSet1);
(cr1.ReportDefinition.ReportObjects["text5"] as TextObject).Text="wangtao";
Form2 f2=new Form2();
f2.crystalReportViewer1.ReportSource=cr1;
f2.Show();