ReportDocument cryRpt = new ReportDocument(); cryRpt.Load("E:\\Visual Studio\\Al Barkat Project\\bt\\Forms\\Reports\\SalesInvoice.rpt"); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables; crConnectionInfo.ServerName = "MUKHTAR"; crConnectionInfo.DatabaseName = "RetailPharmacy"; crConnectionInfo.UserID = "sa"; crConnectionInfo.Password = "123"; CrTables = cryRpt.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables) { crtableLogoninfo = CrTable.LogOnInfo; crtableLogoninfo.ConnectionInfo = crConnectionInfo; CrTable.ApplyLogOnInfo(crtableLogoninfo); } cryRpt.Refresh(); cryRpt.PrintToPrinter(1, true, 0, 0);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)