using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindReport();
}
private void BindReport()
{
string strProvider = "server=.\\sqlexpress;database=BestChina;uid=bestchina;pwd=supply";
CrystalReport1 oCR = new CrystalReport1();
Dataset1 ds = new Dataset1();
SqlConnection MyConn = new SqlConnection(strProvider);
MyConn.Open();
string strSel = "Select * from ProjectStage";
SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel, MyConn);
MyAdapter.Fill(ds, "ProjectStage");
oCR.SetDataSource(ds);
this.CrystalReportViewer1.ReportSource = oCR;
}
}
CrystalReport1”(是否缺少 using 指令或程序集引用?)在线等急!!谢谢
7 个解决方案
#1
不明白问题,引用这两个就够了.
#2
为什么至今为止一直没人问过类似的问题呢,我想原因应该是他们的CrystalReport包括数据源都是工具面板里拖进去的,所以不需要手工添加,你为什么不尝试工具面板拖进那个CrystalReport控件呢?拖进去的时候会自动添加Dll的引用的。
#3
用弱类型ReportDocument
ReportDocument myReport = new ReportDocument();
string reportPath = Server.MapPath("crystalreport1.rpt");
myReport.Load(reportPath);
//绑定数据集,注意,一个报表用一个数据集。
myReport.SetDataSource(dt1);
CrystalReportViewer1.ReportSource = myReport;
#4
winform 用这种方法不行。。 这是asp.net得写法。
#5
缺水晶报表的三个dll吧????
#6
噢! 我知道了! 应该 先放CrystalReportViewer1控件,在控件上绿箭头上 创建 crystalreport1 就可以new了!!
#7
先建 crystalreport1 默认是pull模式
#1
不明白问题,引用这两个就够了.
#2
为什么至今为止一直没人问过类似的问题呢,我想原因应该是他们的CrystalReport包括数据源都是工具面板里拖进去的,所以不需要手工添加,你为什么不尝试工具面板拖进那个CrystalReport控件呢?拖进去的时候会自动添加Dll的引用的。
#3
用弱类型ReportDocument
ReportDocument myReport = new ReportDocument();
string reportPath = Server.MapPath("crystalreport1.rpt");
myReport.Load(reportPath);
//绑定数据集,注意,一个报表用一个数据集。
myReport.SetDataSource(dt1);
CrystalReportViewer1.ReportSource = myReport;
#4
winform 用这种方法不行。。 这是asp.net得写法。
#5
缺水晶报表的三个dll吧????
#6
噢! 我知道了! 应该 先放CrystalReportViewer1控件,在控件上绿箭头上 创建 crystalreport1 就可以new了!!
#7
先建 crystalreport1 默认是pull模式