读书人

CrystalDecisions.CrystalReports.Eng

发布时间: 2012-01-05 22:36:54 作者: rapoo

CrystalDecisions.CrystalReports.Engine.DataSourceException: 该报表不包含表。
这是我这网上找的代码,运行是就报标题的错了,错在哪?
string sql = "SELECT dbimpression, dbctr, dbclick FROM t_inputdb where mediaid='sina'";
   string DBConfig_sql =@"Data Source=(local);Initial Catalog = adoa;uid=sa;Password=ebooom";
   DataSet ds = new DataSet();
   SqlConnection sqlCon = new SqlConnection(DBConfig_sql);
   SqlCommand sqlCmd = new SqlCommand(sql, sqlCon);
   SqlDataAdapter sqlAd = new SqlDataAdapter();
   sqlAd.SelectCommand = sqlCmd;
   sqlAd.Fill(ds, "sql");
   CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport11.rpt"));
   //注意此处必需指明Dataset中的表的名称,否则会提示“您请求的报表需要更多信息.”
   CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables["sql"]);
   //{?}中的参数可以不用赋值,即使赋了值也不起作用。
   // CrystalReportSource1.ReportDocument.ParameterFields["Parm"].CurrentValues.AddValue("1234567");
   CrystalReportSource1.ReportDocument.ParameterFields["Title"].CurrentValues.AddValue("这时推模式的报表样例!");
   CrystalReportSource1.DataBind();
   CrystalReportViewer1.ReportSource = CrystalReportSource1;
   CrystalReportViewer1.DataBind();

[解决办法]
你设计的时候报表上的列是根据什么来的啊
要先建个连接,把列加在报表上啊

读书人网 >asp.net

热点推荐