Carregar o crystalReportViewer passando parâmetro
//Obs.: Criar um xsd ... public void carregaRpt( string sala) { CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rpt.Load(@cls.caminhoRelatorio() + "rel_aluno_por_turma.rpt" ); SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); Aluno_por_turma ds = new Aluno_por_turma(); cmd.CommandText = "SELECT * FROM VW_ALUNO_POR_TURMA WHERE SALA = '" + sala + "' " ; cmd.CommandType = CommandType.Text; cmd.Connection = cls.conexao( "GAP" ); da.SelectCommand = cmd; da.Fill(ds.Tables[ "DataTable1" ]); rpt.Database.Tables[0].SetDataSource(ds); crystalReportViewer1.ReportSource = rpt; }