こんにちは、開発者の皆様、これは Crystal レポートを生成するための関数です。これは、レポート名と ReportQuery を入力パラメータとして受け取り、データセットを生成します。このデータセットを使用して、レポートをどのようにデザインできますか??これは実行時に生成されるためです、ReportDesign を生成するためにどのようにアクセスできますか??
public void fnLoadDataToReport(string rptName, string rptQuery)
{
try
{
DataSet myDS=new DataSet();
// crReportDocument.Load(Server.MapPath("Reports\" & RptName), OpenReportMethod.OpenReportByTempCopy);
crReportDocument.Load(Server.MapPath("Reports\\" + rptName ));
SqlConnection myConnection=new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
SqlCommand myCommand=new SqlCommand(rptQuery,myConnection);
SqlDataAdapter MyDA=new SqlDataAdapter(myCommand);
MyDA.Fill(myDS,"ReportTable");
crReportDocument.SetDataSource(myDS);
crvReportGeneration.ReportSource=crReportDocument;
crvReportGeneration.ShowFirstPage();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
どんな助けでもかなりです....!