看看这段代码对你有没有用处:
string strProvider = "Server=(local);;DataBase=pubs;;UID=sa;;PWD=";;
CrystalReport1 oCR = new CrystalReport1();;
Dataset1 ds = new Dataset1();;
SqlConnection MyConn = new SqlConnection(strProvider);;
MyConn.Open();;
string strSel = "Select * from Stores";;
SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,MyConn);;
MyAdapter.Fill(ds,"stores");;
oCR.SetDataSource(ds);;
this.CrystalReportViewer1.ReportSource = oCR;;