在"Crystal报表参数"字段中显示重复值. [英] Displaying repetitive value in Crystal Report Parameter field.

查看:84
本文介绍了在"Crystal报表参数"字段中显示重复值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Crystal Report中有一个Parameter字段,其值必须使用数据库在后面的Code中绑定.但是它仅显示单个Record ..
代码示例为:

I have a Parameter field in crystal Report whose value has to binded from Code behind using database.But it is displaying only a single Record..
The Code sample is :

for (int i = 0; i < dt.Rows.Count; i++)
{
    rpt.SetParameterValue("MEMBERNM", dt.Rows[i]["NAME"].ToString());
}


我想显示从该字段中的数据库中获取的所有记录.
请帮助尽快.


I want to diplay all records fetched from the database in that field.
Plese help ASAP.

推荐答案

write your code then i can better help you.
on which type of application you are using (WebApplication/WindowsApplication) ?

you can drag field in detail part for display number of repetative values.


Process For Implement Crystal Report in Asp.net Application





Ingredients:

    Visual Studio .NET or Visual Studio 2008  SQL Server 2005 Microsoft windows XP Professional  

Recipe

   (1) Preparing SQL Server to run ASP .NET Application Open the SQL Server Enterprise manager, Expand SQL Server
       Group -> Computer Name -> Security. Then right-click on logins and New Login... . On General tab click on
       ellipses in front of the name textbox. Select ASPNET and click on Add, the press OK to add ASPNET account  to 
       logins. Then click on Database Access tab and check Database in the list. Press OK and make sure if the 
       ComputerName\ASPNET account is added to logins list. You don't need to give any other permission. Public user has
       read and write permission to Database.

   (2) Creating a New ASP .NET web application Run the visual Studio .NET and Create a new project. In the project types
       select Visual Basic Projects, and for the template select ASP .NET Web Application. Change the location to
       http://localhost/CrystalRepSample and click OK.

  (3)  Connecting the application to  Database in SQL Server and filling the DataSet with Database data.
       Open the server explorer (Ctl+Alt+S), right-click on Data Connections, and then Add Connection, for the server
       name type localhost or (local) or the SQL Server instance name. Select Use windows NT Integrated security and
       then select Database from Select the database on the server.In the server explorer expand the newly created
       connection to Database,expand the Tables and the drag the products table and drop it on the form. This creates an
       SQL ServerConnection object to Database as ServerConnection1, and the SQLDataAdaptor1 to pump the data to the
       DataSet that we are just about to create.Right-click on the SQLDataAdaptor1 and click on Generate DataSet... and
       then in the Generate Dataset dialog box just accept the defaults and click OK. The DataSet11 will be added to 
       your form.Double-Click on the Webform1 that will open the webform in code view. In the page load event add the
       proper code to populate the dataset using SQLDataAdaptor1 as following:
       SqlDataAdapter1.Fill(DataSet11, "Products")
        Now we have a dataset with data that we can provide the data to report designer.

  (4)  Creating the report with Crystal Designer In the project menu select Add New Item... In the templates box select
       Crystal Report, change the name to rpProducts.rpt and and click Open.To save the time just accept the Report
       Expert and standard report and press OK.In the Standard report expert dialog box in the available data sources
       expand project data. Expand ADO .NET DataSets and expand CrystalRepSample.DataSet1, you will find Products table
       in there. Select it and click insert table. Then click Next.In the Fields tab just select some fields and click
       Add.Just click on Finish button and your report is ready.At the moment we have a report that reads data from an
       ADO .NET DataSet

  (5)  Creating the web interface to present report Open the Webform1.aspx in design mode.Click on a white space on the
       form and the in the properties window set the pageLayout to FlowLayout. (This step is very important because we
       are using as Web Custom Control)Go to the toolbox and click on Web Forms then select CrystalReportViewer from the
       list and drag and drop it in the webform1.aspx. CrystalReportViewer1 will be added to the form.

  (6)  Providing the data to report Open webform1.aspx in Code View and go to Page_Load sub.AFTER the line of code that
       you have already added, add the following code Dim cr As New rpProducts() ' Creates the ReportDocument object
       cr.SetDataSource(DataSet11) ' Defines the source of data for report which is DataSet11
       CrystalReportViewer1.ReportSource = cr ' Makes the ReoprtViewer web control to know it's report source
       CrystalReportViewer1.DataBind() ' You need to remind CrystalReportViewer1 that there is some data. Update the  
       interface
         
  (7)  Building and testing the application


这篇关于在"Crystal报表参数"字段中显示重复值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆