reportdocument cryrpt

1
ReportDocument cryRpt = new ReportDocument(); cryRpt.Load("D:\\ETAP\\visualstudio.programas\\testemodulo11\\Alunos.rpt"); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables; crConnectionInfo.ServerName = "(local)"; crConnectionInfo.DatabaseName = "BD_alunos"; 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(2, true, 1, 2); DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(); CConexao con = new CConexao(); con.open(); SqlDataAdapter SAdapter = new SqlDataAdapter("Select *from Alunos", con.GetCon()); cmd.Connection = con.GetCon(); //Engine ReportDocument rep = new ReportDocument(); string strReportPath = "D:\\ETAP\\visualstudio.programas\\testemodulo11\\Alunos.rpt"; rep.Load(strReportPath);

Upload: ruben-goncalves

Post on 20-Apr-2015

43 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ReportDocument cryRpt

ReportDocument cryRpt = new ReportDocument(); cryRpt.Load("D:\\ETAP\\visualstudio.programas\\testemodulo11\\Alunos.rpt"); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables; crConnectionInfo.ServerName = "(local)"; crConnectionInfo.DatabaseName = "BD_alunos"; 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(2, true, 1, 2);

DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(); CConexao con = new CConexao(); con.open(); SqlDataAdapter SAdapter = new SqlDataAdapter("Select *from Alunos", con.GetCon()); cmd.Connection = con.GetCon(); //Engine ReportDocument rep = new ReportDocument(); string strReportPath = "D:\\ETAP\\visualstudio.programas\\testemodulo11\\Alunos.rpt"; rep.Load(strReportPath);