新手请教 windows中 reportview控件的使用(详细步骤)谢谢我这里怎么都显示不了 主要想看数据源 源代码等 谢谢 

解决方案 »

  1.   


    try
                {
                    aReportDocument.Load(@Application.StartupPath + "\\自定义单据\\" + g_单据类型 + ".rpt");
                }
                catch (Exception)
                {
                    MessageBox.Show("去把rpt文件放在路径: \\KySoft\\bin\\Debug\\自定义单据 .");
                    return;
                }            foreach (Table aTable in aReportDocument.Database.Tables)
                {
                    aTable.LogOnInfo.ConnectionInfo.ServerName = "数据源名称";          
                    aTable.LogOnInfo.ConnectionInfo.DatabaseName = "数据库名称";
                    aTable.LogOnInfo.ConnectionInfo.UserID = "用户名称";         
                    aTable.LogOnInfo.ConnectionInfo.Password = "用户密码";                       aTable.ApplyLogOnInfo(aTable.LogOnInfo);
                }
      

  2.   

    完整的使用步骤有吗 我在界面添加数据源 报表也设计好了 我的代码private void Form1_Load(object sender, EventArgs e)
            {
                DataTable dt = ReportViewerLib.Customer.GetData("selectproduct", 2);//自己写的掉存储过程方法 
                ReportDataSource rds = new ReportDataSource("aaaa",dt);      
                ReportParameter rp = new ReportParameter("SubTitle", "List of all the customers");
                this.reportViewer1.LocalReport.DataSources.Add(rds);
                this.reportViewer1.RefreshReport();
            }
      

  3.   

    大哥  存储过程 实现都写好了 都掉方法了!!!   类里面方法已经写好!! dt是返回来的 数据!! 
     DataTable dt = ReportViewerLib.Customer.GetData("selectproduct", 2);//自己写的掉存储过程方法