日期:2014-05-20 浏览次数:20736 次
private void button1_Click(object sender, EventArgs e)
{
string connstr = "Provider=MSDAORA;Data Source=my02;Password=my123;User ID=my";
OleDbConnection conn = new OleDbConnection(connstr);
string cmdstr = "select code from BANKINFO";
OleDbDataAdapter da = new OleDbDataAdapter(cmdstr, conn);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
conn.Open();
DataSet ds = new DataSet1();
da.Fill(ds.Tables["mytable"]);
conn.Close();
string reportpath =Application.StartupPath+@"\CrystalReport1.rpt";
ReportDocument rd = new ReportDocument();
rd.Load(reportpath);
rd.SetDataSource(ds);
this.crystalReportViewer1.ReportSource = rd;
}
………………
…………
DataSet ds = new DataSet1();
da.Fill(ds.mytable);
conn.Close();
ReportDocument rd = new CrystalReport1();