日期:2014-05-18 浏览次数:21358 次
private void button1_Click(object sender, EventArgs e)
{
string sSQLString = "SELECT * FROM Repair";
string sConn = "Persist Security Info=false;" +
"Integrated Security=SSPI;database=FDB;server=CMUYU-PC;Connect Timeout=30;";
SqlConnection conn1 = new SqlConnection(sConn);
SqlCommand comm1 = new SqlCommand(sSQLString, conn1);
SqlDataAdapter sd = new SqlDataAdapter(comm1);
//DataBase db = new DataBase();
DataSet dataset1 = new DataSet();
conn1.Open();
sd.Fill(dataset1);
conn1.Close();
comm1.Dispose();
conn1.Dispose();
//db.Dispose();
this.reportViewer1.LocalReport.ReportEmbeddedResource = "report.Report1.rdlc";
this.reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rds = new ReportDataSource("Dataset1", dataset1.Tables[0]);
this.reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.RefreshReport();
}
rvUserStat.LocalReport.ReportPath = "rptUserInfo.rdlc";
rvUserStat.ShowParameterPrompts = false;
ReportDataSource _rds = new ReportDataSource();
_rds.Name = "dsUserInfo_dtUserInfo";
_rds.Value = ds.Tables[0];
rvUserStat.LocalReport.DataSources.Clear();
rvUserStat.LocalReport.DataSources.Add(rds);
rvUserStat.LocalReport.Refresh();