仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 582|回复: 8
打印 上一主题 下一主题

[学习教程] ASP.NET网站制作之VC#中利用Crystal Report

[复制链接]
小妖女 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:32:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
完全不一样的。.net其实我也说不太清,.net可以把他理解为跟J2EE相对的工具。c++主要做系统相关的开发你要学.net的话就应该学C#。(其实微软在.NET平台上也考虑了给C++留一个地位。  赫赫有名的CrystalReports(水晶报表)已内嵌为微软VisualStudio.NET的尺度报表工具,同时晋级到CrystalReportsforVisualStudio.NET。它的长处是:1、在.NET平台可以轻松创立交互式的、高质量展现的报表内容,这也是CrystalReports临时以来所具有的次要上风;2、利用CrystalReportsforVisualStudio.NET,能够在Web平台和Windows平台上承载报表,并将Crystal报表作为报表Web服务在Web服务器上公布;3、使用CrystalReport创立的Web使用程序,利用户能够深化图表并依据必要选择信息。在.NET中,图表实践上就是一个与使用程序中其他控件举行交互的Crystal报表。在这里我向人人先容怎样在Windows窗体使用程序中扫瞄水晶报表。
  计划步骤:
  1、软件情况:请求体系已安装VisualStudio.Net集成开辟体系,仅装有.NetFrameworkSDk不克不及完成本例效果,成为.NetFrameworkSDK没有水晶报表控件。
  2、新建一个VisualC#项目Windows使用程序,设置Form1的Text="水晶报表扫瞄器",StartPosition=CenterScreen//程序入手下手呈现在屏幕中心,别的属性均坚持默许;
  3、从工具箱拖进一个CrystalReportViewer,一个Button,一个openFileDialog,到窗体。
  全部计划器的窗体结构只需将button1置于窗体底边中部,不再必要别的过剩结构。
  设置crystalReportViewer1的属性以下:
this.crystalReportViewer1.Dock=System.Windows.Forms.DockStyle.Fill;
//停靠体例为充斥全部窗体
//睁开+DockPadding
this.crystalReportViewer1.DockPadding.Bottom=50;
//底部空出安排Button的地区
this.crystalReportViewer1.DockPadding.Left=5;
this.crystalReportViewer1.DockPadding.Right=5;
this.crystalReportViewer1.DockPadding.Top=5;
this.crystalReportViewer1.ReportSource=null;
//先不载进报表资本
  设置button1的属性以下:
this.button1.Anchor=System.Windows.Forms.AnchorStyles.Bottom;
//与窗体的下边坚持流动
this.button1.Text="翻开报表";
openFileDialog1是翻开文件的控件,设置其属性以下:
this.openFileDialog1.Filter
="CrystalReport(*.rpt)|*.rpt|一切文件(*.*)|*.*";
//供应翻开文件对话框的文件范例,
默许范例就是此字符串的最前一种界说的范例
this.openFileDialog1.Title="翻开水晶报表";
//翻开文件对话框的题目
  结构最终效果以下:




  4、双击button1,增加button1_Click点击事务:
privatevoidbutton1_Click(objectsender,System.EventArgse)
{
 try
 {
  if(openFileDialog1.ShowDialog()==DialogResult.OK)
   this.crystalReportViewer1.ReportSource=@openFileDialog1.FileName;
   //加载水晶报表,将报表文件绑定到CrystalReportView控件;
 }
 catch(Exceptionerror)
 {
  MessageBox.Show(error.ToString(),"毛病");
 }
}
  5、OK!按Ctrl+F5运转吧。
  能够扫瞄你体系内现有的报表实例:
...ProgramFilesMicrosoftVisualStudio.NETCrystalReportsSamplesReportsFeatureExamplesChart.rpt




usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
namespaceWindowsApplication10
{
 ///<summary>
 ///Form1的择要申明。
 ///</summary>
 publicclassForm1:System.Windows.Forms.Form
 {
  privateCrystalDecisions.Windows.Forms.CrystalReportViewercrystalReportViewer1;
  privateSystem.Windows.Forms.Buttonbutton1;
  privateSystem.Windows.Forms.OpenFileDialogopenFileDialog1;
  ///<summary>
  ///必须的计划器变量。
  ///</summary>
  privateSystem.ComponentModel.Containercomponents=null;
  publicForm1()
  {
   //
   //Windows窗体计划器撑持所必须的
   //
   InitializeComponent();
   //
   //TODO:在InitializeComponent挪用后增加任何机关函数代码
   //
  }
  ///<summary>
  ///清算一切正在利用的资本。
  ///</summary>
  protectedoverridevoidDispose(booldisposing)
  {
   if(disposing)
   {
    if(components!=null)
    {
     components.Dispose();
    }
   }
   base.Dispose(disposing);
  }
  #regionWindowsFormDesignergeneratedcode
  ///<summary>
  ///计划器撑持所需的办法-不要利用代码编纂器修正
  ///此办法的内容。
  ///</summary>
  privatevoidInitializeComponent()
  {
   this.crystalReportViewer1=new
   CrystalDecisions.Windows.Forms.CrystalReportViewer();
   this.button1=newSystem.Windows.Forms.Button();
   this.openFileDialog1=newSystem.Windows.Forms.OpenFileDialog();
   this.SuspendLayout();
   //
   //crystalReportViewer1
   //
   this.crystalReportViewer1.ActiveViewIndex=-1;
   this.crystalReportViewer1.Dock=System.Windows.Forms.DockStyle.Fill;
   this.crystalReportViewer1.DockPadding.Bottom=50;
   this.crystalReportViewer1.DockPadding.Left=5;
   this.crystalReportViewer1.DockPadding.Right=5;
   this.crystalReportViewer1.DockPadding.Top=5;
   this.crystalReportViewer1.Name="crystalReportViewer1";
   this.crystalReportViewer1.ReportSource=null;
   this.crystalReportViewer1.Size=newSystem.Drawing.Size(292,273);
   this.crystalReportViewer1.TabIndex=0;
   //
   //button1
   //
   this.button1.Anchor=System.Windows.Forms.AnchorStyles.Bottom;
   this.button1.Location=newSystem.Drawing.Point(104,240);
   this.button1.Name="button1";
   this.button1.TabIndex=1;
   this.button1.Text="翻开报表";
   this.button1.Click+=newSystem.EventHandler(this.button1_Click);
   //
   //openFileDialog1
   //
   this.openFileDialog1.Filter="CrystalReport(*.rpt)|*.rpt|一切文件(*.*)|*.*";
   this.openFileDialog1.Title="翻开水晶报表";
   //
   //Form1
   //
   this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
   this.ClientSize=newSystem.Drawing.Size(292,273);
   this.Controls.AddRange(newSystem.Windows.Forms.Control[]{
    this.button1,
    this.crystalReportViewer1});
   this.Name="Form1";
   this.StartPosition=System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text="水晶报表扫瞄器";
   this.ResumeLayout(false);
  }
  #endregion
  ///<summary>
  ///使用程序的主出口点。
  ///</summary>
  [STAThread]
  staticvoidMain()
  {
   Application.Run(newForm1());
  }
  privatevoidbutton1_Click(objectsender,System.EventArgse)
  {
   try
   {
    if(openFileDialog1.ShowDialog()==DialogResult.OK)
     this.crystalReportViewer1.ReportSource=@openFileDialog1.FileName;
     //加载水晶报表,将资本报表绑定到水晶报表检察器
   }
   catch(Exceptionerror)
   {
    MessageBox.Show(error.ToString(),"毛病");//处置非常毛病
   }
  }
 }
}
你觉得数据库怎么样?
若相依 该用户已被删除
沙发
发表于 2015-1-18 09:58:01 | 只看该作者
ASP.net的速度是ASP不能比拟的。ASP.net是编译语言,所以,当第一次加载的时候,它会把所有的程序进行编译(其中包括worker进程,还有对语法进行编译,形成一个程序集),当程序编译后,执行速度几乎为0。
谁可相欹 该用户已被删除
板凳
发表于 2015-1-21 18:51:51 | 只看该作者
众所周知,Windows以易用而出名,也因此占据不少的服务器市场。
因胸联盟 该用户已被删除
地板
发表于 2015-1-30 21:50:40 | 只看该作者
虽然在形式上JSP和ASP或PHP看上去很相似——都可以被内嵌在HTML代码中。但是,它的执行方式和ASP或PHP完全不同。在JSP被执行的时候,JSP文件被JSP解释器(JSPParser)转换成Servlet代码,然后Servlet代码被Java编译器编译成.class字节文件,这样就由生成的Servlet来对客户端应答。所以,JSP可以看做是Servlet的脚本语言(ScriptLanguage)版。
愤怒的大鸟 该用户已被删除
5#
发表于 2015-2-6 16:10:30 | 只看该作者
在一个项目中谁敢保证每天几千万甚至几亿条的数据不丢失?谁敢保证应用的高可靠性?有可以借签的项目吗?
不帅 该用户已被删除
6#
发表于 2015-2-17 03:28:53 | 只看该作者
在调试JSP代码时,如果程序出错,JSP服务器会返回出错信息,并在浏览器中显示。这时,由于JSP是先被转换成Servlet后再运行的,所以,浏览器中所显示的代码出错的行数并不是JSP源代码的行数。
再见西城 该用户已被删除
7#
发表于 2015-3-5 15:10:37 | 只看该作者
但是java靠开源打出的一片天地,特别是在微软的垄断下能打开今天的局面还是有它的生命力的。
灵魂腐蚀 该用户已被删除
8#
发表于 2015-3-12 08:56:13 | 只看该作者
JSP/Servlet虽然在国内目前的应用并不广泛,但是其前途不可限量。
9#
发表于 2015-3-19 19:45:45 | 只看该作者
可以通过在现有ASP应用程序中逐渐添加ASP.NET功能,随时增强ASP应用程序的功能。ASP.NET是一个已编译的、基于.NET的环境,可以用任何与.NET兼容的语言(包括VisualBasic.NET、C#和JScript.NET.)创作应用程序。另外,任何ASP.NET应用程序都可以使用整个.NETFramework。开发人员可以方便地获得这些技术的优点,其中包括托管的公共语言运行库环境、类型安全、继承等等。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-19 17:50

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表