コードを使用して Crystal レポートを作成して入力しようとしていますが、エラーが発生しました。 レポート にはテーブルがありませんが、DATASET からデータを抽出しようとすると、正確なデータが表示され、問題はありませんが、Crystal レポートでは機能しません。
コード:
protected void Dataset_load()
{
SqlConnection sqlcon = new SqlConnection(conStr);
SqlCommand sqlCom = new SqlCommand("select * from Login", sqlcon);
SqlDataAdapter sqlDA = new SqlDataAdapter(sqlCom);
DataSet ds = new DataSet("CRDataSet");
try
{
sqlcon.Open();
//sqlCom.ExecuteNonQuery();
sqlDA.Fill(ds,"Login");
ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("CrystalReport.rpt").ToString());
rd.SetDataSource(ds.Tables["Login"]);
CrystalReportViewer1.ReportSource = rd;
}
catch (Exception exc)
{
Response.Write(exc.Message);
}
finally
{
sqlcon.Close();
}