ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How do we access crystal reports in .NET?

user-image
تم إضافة السؤال من قبل Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
تاريخ النشر: 2013/07/14
Ahmed Adel
من قبل Ahmed Adel , Application Engineer , Intercom Enterprises

steps: • Add a new web project • Add a new item to the project “crystal report” • Choose “Using the report wizard” to create a new report or simply choose “From an existing report” if you already have an existing crystal report.
You could choose a “blank report” to create a report form scratch”.
• Choose the data source • Browse data and fields that you want to show in the report.
• And choose finish • Now you can design the report and customize it If you want you add crystal report in web/windows forms as well using crystal report viewer control.

OMAR ABDULWAHAB
من قبل OMAR ABDULWAHAB , programmer , knone

i dont deal with Crystal Report its not free i build my own report from zero in vb.net using printpage, printdocument class

Syed Nasser Ahmed
من قبل Syed Nasser Ahmed , Lead Consultant for Microsoft Technologies , Stanley Black & Decker

The .RPT files are created using the Crystal Reports Designer, which is available as a stand-alone program, or an add-in to Visual Studio.
Many versions of Visual Studio ship with a version of the Crystal Reports designer add-in, meaning you can create Crystal Reports within Visual Studio without having to buy additional software or licenses.
After you have created the Crystal Report file, the next step is defining a data schema.
After you have “informed” the Crystal Report file of the data schema, a list of fields obtained from the data schema, will appear in the field explorer.
Once the fields appear in the field explorer, you can "drag" the field to the report.
Below is what the EmployeeData.xml contains.
You will notice each field is listed with the data type.
Listing:- To "inform" the Crystal Reports file of the data schema, click on the Database Expert option in the toolbar, click Create New Connection and select ADO.NET (XML) , and select the data schema that was just generated.
Once your data schema has been defined, you should see a list of columns in the Field Explorer under Database Fields.
Now that the Crystal Reports file has been created, you need to display the report in your project.
For our example, we will be using the Crystal Reports ASP.NET controls.
The methods outlined here are very similar to the Win Forms controls as well.
To view your newly created Crystal Report file in your custom application, you will need to use the Crystal Report Viewer control as shown in the code below.
Untitled Page Now that the control is on the page, we need to “inform” the Crystal Reports Viewer control of the Crystal Reports file.
We can do this in the code behind with the code that follows.
ReportDocument employeesReport = new ReportDocument(); crvMain.ReportSource = employeesReport; After this step has been completed, we need set the data for the Crystal Report file that was loaded in the viewer.
We simply use the SetDataSource method on the ReportDocument object.
ReportDocument employeesReport = new ReportDocument(); employeesReport.Load(@"\Employees.rpt"); employeesReport.SetDataSource(employees); crvMain.ReportSource = employeesReport; When all is said and done, you should have some type of method that looks similar to the LoadReport method below.
private void LoadReport() { List employees = GetEmployeesAsList(); DataSet employeeDataSet = ListToDataset(employees); ReportDocument employeesReport = new ReportDocument(); try { employeesReport.Load(@"Reports\Employees.rpt"); employeesReport.SetDataSource(employees); crvMain.ReportSource = employeesReport; } catch (Exception ex) { lblError.Text = string.Format ("A system error has occurred while loading the report {0}", ex.Message); } finally { employeesReport = null; } } If you have followed all the steps above, you should now have your Crystal Report rendering in your custom application.

Raza Hussain Rajpar
من قبل Raza Hussain Rajpar , Manager , DMS Research Pvt Ltd

' Crysatl report must be installed ' Add a new webPage and then drag and drop crystalreportviewer from ToolBox's Reporting section on it.
' Add a new item to the project crystal report ' Choose "Using the report wizard" to create a new report or simply choose "From an existing report" ' if you already have an existing crystal report.
You could choose a "blank report" to create a report form scratch.
' Choose the data source ' Browse data and fields that you want to show in the report then choose finish ' Now you can design the report and customize it ' then add following code to web page //initiate report document object ReportDocument _rDocument = new ReportDocument(); //locate specified report "abc.rpt" string _path = Server.MapPath("abc.rpt"); // load specified report in report document _rDocument.Load(_path); // Set Data Source to specified report _rDocument.SetDataSource(dsReport.Tables[0]); // set report document to Crystal report viewer CrystalReportViewer1.ReportSource = _rDocument;

تكوين تقرير جديد:ننقر بزر الماوس الايمن على المشروع لعرض قائمة مختصرة solution explorer1.
فى نافذةadd new item وننقر على add2.
نشير الىوننقر فتح crystal report3.
يظهر مرع حوار نختار منهوبه ثلاث خيارات crystal reports gallery4.
يظهر مربع حوار5.
الاول استخدام خبير التقارير-يقودنا خلال عملية تكوين التقرير واضافة اختياراتنا الى مصممالتقارير6.
الثانى يفتح تقرير خالى-7.
الخيار الاخير استخدام تقرير موجود-يؤدى الى تكوين تقرير جديد بنفس تصميم تقرير اخرok8.
ننقرلاختيار مصادر البيانات وربطها بالتقريرثم نختار بند database field ننقر بزر الماوس الايمن على بند field explorer -1 فى مربعadd/remove database-2 فى حالة عدم وجود اتصال مع مصدر بيانات يجب تكوين اتصال بالنقر على احد مصادر البياناتثم اختيار مورد البيانات المطلوب من مربع حوار مورد البياناتنتصفح المجلدات الى ان نجد جداول مصدر البيانات database expert -3 فى مربع حوارالمستخدم-4 نختار الجداول التى تحتوى على البيانات التى نريد اعداد تقرير منها ثم ننقر على الزر الخاص>>ok فى مربع الاحوار ثم ننقر selected tables -5 باضافتها الى جانبلتكوبن كائن امرثم ننفر field explorer  ننقر بزر الماوس الايمن على يشفشلاشسث بهثمس فى مربعadd/remove databaseنتصفح المجلدات الى ان نصل الى مصدر البيانات الخاص database expert - فى مربع حواربناadd command  اسفل مصدر البيانات ننقر نقرا مزدوجا على عقدةندخل الامر او الاستعلام المناسب لمصدر البيانات add command to report  فى مربع حوارfield يترتب على ذلك العودة الى مصمم التقرير وظهور الجدول الافتراضى فى مربع ok ننقرexplorer

المزيد من الأسئلة المماثلة