Crystal reports example/sample in asp. ASP. NET,C#. NET,VB. NET,JQuery,Java. Script,Gridview. Introduction: In this article I will explain how to create crystal reports example in asp. To implement crystal reports first design the table in database and give name User. Infomation. Column. Name. Data. Type. User. Id. Int(set identity property=true)User. Namevarchar(5. 0)First. Name. Varchar(5. 0)Last. Namevarchar(5. 0)Locationvarchar(5. After completion of table creation enter some dummy data because we need to use that data to populate reports. Now Open visual studio and create new website after that right click on your website and select Add new item in that select Crystal Report and click Add. After that add crystal report then it will prompt Crystal Report Gallery window in that select blank solution and click OK A blank report will create in our application now click on Crystal. Reports menu under that select Database under that select Database Expert. After click on Database Expert now Database Expert wizard will open in that select Create New Section > > select OLE DB (ADO) > > in that click on + sign of OLE DB (ADO) Now select Microsoft OLE DB Provider for SQL Server and click Next (Here we can select SQL Native client option also but sometimes during deployment if servers not contains this native client it will throw error). Now enter SQL Server name, username, password and required database and click Next. After enter credentials for your required database click Next then click Finish (Here for my database I didn’t set any credentials for that reason I didn’t enter userid and password details don’t get confused). After click Finish now our database loaded in OLEDB (ADO) section > > select your database > > select dbo > > select required tables. Now open tables in that select required table and move to selected tables section and click OK After that Database Fields in Field Explorer populated with our required data table now drag and drop the required fields from data table to reports Details section. Now open your Default. Crystal. Report. Viewer control from Reporting tab. Now select Crystal. Report. Viewer and click on smart tag in right hand side and Choose new Report Source Whenever we click on New report source one window will open in that select crystal report for Report Source from the available reports in dropdownlist and click OK. After assign available report to Crystal. Report. Viewer control check your code that would be like this < %@Register. In Visual Studio 2015, I cannot find the designer for RDLC reports anymore. Does anyone know if this is only a bug and if it is provided later on or if Microsoft. Version 2.0 of Microsoft's cross-platform,NET pivot changes everything. Join us as we explore.NET Core 2.0, ASP.NET Core 2.0, and.NET Standard 2.0. Assembly="Crystal. Decisions. Web, Version=1. Culture=neutral, Public. Key. Token=6. 92fbea. Namespace="Crystal. Decisions. Web"Tag. Prefix="CR"%> < htmlxmlns="http: //www. Crystal Report Sample< /title> < /head> < body> < formid="form. CR: Crystal. Report. Viewer. ID="Crystal. Report. Viewer. 1"runat="server"Auto. Data. Bind="True"Report. Source. ID="Crystal. Note: 2008 and older issues are only available as.chm files. On most versions of windows you must first save these files to your local machine, and then unblock the. Report. Source. 1"/> < CR: Crystal. Report. Source. ID="Crystal. Report. Source. 1"runat="server"> < Report. File. Name="Crystal. Report. rpt"> < /Report> < /CR: Crystal. Report. Source> < /div> < /form> < /body> < /html> Now run your application your report will be like this In case your report prompt window for User. Name and password before we access data in that situation we need to set those details in code behind instead of assign crystal report to Crystal. Report. Viewer control. Drag and drop Crystal. Report. Viewer control click on right side smart tag of your Crystal. Report. Viewer control and uncheck Enable. Database. Logon. Prompt. Our aspx code will be like this < %@Register. Assembly="Crystal. Decisions. Web, Version=1. Culture=neutral, Public. Key. Token=6. 92fbea. Namespace="Crystal. Decisions. Web"Tag. Prefix="CR"%> < htmlxmlns="http: //www. Crystal Report Sample< /title> < /head> < body> < formid="form. CR: Crystal. Report. Viewer. ID="Crystal. Report. Viewer. 1"runat="server"Auto. Data. Bind="True"Report. Source. ID="Crystal. Report. Source. 1"/> < CR: Crystal. Report. Source. ID="Crystal. Report. Source. 1"runat="server"> < Report. File. Name="Crystal. Report. rpt"> < /Report> < /CR: Crystal. Report. Source> < /div> < /form> < /body> < /html> Now Open your code behind file and set database connection settings and assign reports to the control before that first add following namespaces using System; using Crystal. Decisions. Crystal. Reports. Engine; After add namespaces write the following code in page load event. C# codeprotectedvoid Page_Load(object sender, Event. Args e){Report. Document reportdocument = new. Report. Document(); reportdocument. Load(Server. Map. Path("Crystal. Report. Set. Database. Logon("username","password","Suresh. Dasari","My. Sample. DB"); Crystal. Report. Viewer. 1. Report. Source = reportdocument; }VB. NET Code. Imports Crystal. Decisions. Crystal. Reports. Engine. Partial. Class. Default. 2Inherits System. Web. UI. Page. Protected. Sub Page_Load(sender As. Object, e As. Event. Args) Handles. Me. Load. Dim reportdocument As. New. Report. Document()reportdocument. Load(Server. Map. Path("Crystal. Report. Set. Database. Logon("", "", "Suresh. Dasari", "My. Sample. DB")Crystal. Report. Viewer. 1. Report. Source = reportdocument. End. Sub. End. Class. Now run your application and check your output that would be like this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |