ReportDocument cryRpt = new ReportDocument(); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables; cryRpt.Load(MapPath("CrystalReport.rpt")); crConnectionInfo.ServerName = "ICELand"; crConnectionInfo.DatabaseName = "MiniOPT"; crConnectionInfo.UserID = "sa"; crConnectionInfo.Password = "121212"; CrTables = cryRpt.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables) { crtableLogoninfo = CrTable.LogOnInfo; crtableLogoninfo.ConnectionInfo = crConnectionInfo; CrTable.ApplyLogOnInfo(crtableLogoninfo); } CrystalReportViewer1.ReportSource = cryRpt; CrystalReportViewer1.RefreshReport();
Dim mySelectFormula As String = "{#Table.Filed}='444'"
CrystalReportViewer1.ReportSource = cryRpt; CrystalReportViewer1.SelectionFormula = mySelectFormula; CrystalReportViewer1.RefreshReport();