| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 592 人关注过本帖
标题:未将对象引用为实例 报表的问题
只看楼主 加入收藏
zhishiouran
Rank: 1
等 级:新手上路
帖 子:81
专家分:0
注 册:2006-10-15
收藏
 问题点数:0 回复次数:0 
未将对象引用为实例 报表的问题
public class Caigou_list : System.Web.UI.Page
    {

        //protected CrystalDecisions.Web.CrystalReportViewer myCryReports;
        private CrystalDecisions.CrystalReports.Engine.ReportDocument myRPDoc;
        public int pramed;
        //protected PeopleNetAccess myNetAccess;
        protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
    
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            this.PageBind ();
        }

        #region Web 窗体设计器生成的代码
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: 该调用是 Web 窗体设计器所必需的。
            //
            InitializeComponent();
            base.OnInit(e);
        }
        
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {   
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion
        private void PageBind()
        {
            string sqlstring = "select Produce_plan.caigou_id,Produce_plan.plan_year,Produce_plan.plan_area,Produce_plan.goods_num,Produce_plan.goods_danwei,Produce_plan.goods_price,Produce_plan.money,Produce_plan.plan_people,wupin.wp_name,wp_type.wp_type from Produce_plan,wupin,wp_type where Produce_plan.goods_name=wupin.wp_id and Produce_plan.goods_type=wp_type.type_id";
            //Database db = new Database();
            string con = "server=(local);database=lyjxc;User id=sa;Pwd=''";
            SqlConnection myConn = new SqlConnection (con);
            myConn.Open();
            //this.myRPDoc.Load( Server.MapPath( "CryReports/Caigou_List.rpt" ) );
            DataSet myDs = new DataSet();
            //this.getTableData( sqlstring,ref myDs,"Produce_plan");
            if(this.getTableData( sqlstring,ref myDs,"Produce_plan")==false)
            {
                Response.Write("<script language='javascript'>alert('插入成功!')</script>");
            }
            else
            {

                this.myRPDoc.SetDataSource( myDs );

                this.CrystalReportViewer1.ReportSource = this.myRzPDoc;
                this.CrystalReportViewer1.DataBind();
                
            }
            myConn.Close ();
        }
        protected bool getTableData( String strCommand , ref DataSet myDataSet , String TableName  )
        {
            string con = "server=(local);database=lyjxc;User id=sa;Pwd=''";
            SqlConnection myConn = new SqlConnection (con);
            myConn.Open();
            bool returnValue = true;
//            DataSet returnValue;
            SqlCommand myCommand = new SqlCommand( strCommand,myConn );
            SqlDataAdapter myAdapter = new SqlDataAdapter( myCommand );
            try
            {
                myAdapter.Fill( myDataSet,TableName );
            }
            catch
            {
//                returnValue = false;
            }
            return returnValue;
        }
    }
这是代码
我都不知道出现什么的问题,望各位大虾帮帮我
搜索更多相关主题的帖子: 实例 对象 
2008-06-24 19:49
快速回复:未将对象引用为实例 报表的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027025 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved