ReportDocument cryRpt = new ReportDocument(); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables ; string paths = Path.GetDirectoryName(Application.ExecutablePath) + ".\\myreport.rpt"; cryRpt.Load(paths); crConnectionInfo.ServerName = ""; crConnectionInfo.DatabaseName = ".\\mydb.mdb"; crConnectionInfo.UserID = ""; crConnectionInfo.Password = ""; 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.Refresh();
Access/Excel(DAO)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)