正在研究CrystalReport,下面的代码为当sql server密码不为空时的写法
日期:2006-10-23 荐:
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load("x:\\crystalreport\\crPull.rpt");
TableLOGOnInfo LOGOnInfo = new TableLOGOnInfo();
LOGOnInfo = rptDoc.Database.Tables["tblMagUserInfo"].LOGOnInfo;
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo = LOGOnInfo.ConnectionInfo;
connectionInfo.ServerName = "myserver";
connectionInfo.DatabaseName = "mydb";
connectionInfo.UserID = "myid";
connectionInfo.Password = "mypwd";
rptDoc.Database.Tables["tblMagUserInfo"].ApplyLOGOnInfo(LOGOnInfo);
CrystalReportViewer1.ReportSource = rptDoc;
标签: