Hi pietje_puk100!
To begin with something simple, I will create a report from the Customers table of the SQL Server Northwind database and view it in a Windows Forms application. I'll start by creating a new application for Windows in Visual Studio .NET. (I use Visual Basic, but the concepts are portable to all .NET languages.) Once the application is created, right-click the project name in the Solution Explorer, select Add | Add New Item from the context menus. Then in the Add New Item dialog box, select Crystal Report from the Templates list, name the report CustomersBasic.rpt, and click Open.
When the Crystal Report Gallery dialog opens, you can accept the default settings (Using the Report Expert and Standard), and click OK. When the Report Expert opens, drill down on the OLE DB (ADO) branch of the treeview control in the Data tab. When the OLE DB (ADO) dialog opens, select the Microsoft OLE DB Provider for SQL Server, specify the server and login information for your SQL Server, select the Northwind database, then click Finish. Back in the Standard Report Expert, drill down through the Northwind node in the treeview to the Tables node, then double-click the Customers node. In the Fields tab, click the Add All button to add all the fields from the customers table to the report. Next, make sure you assign the report a title and style in the Style tab and click the Finish button.
The Crystal Reports for Visual Studio .NET designer is now activated and your report is displayed. Notice that the Field Explorer window now appears and is docked to the Toolbox and Server Explorer windows. Within the Toolbox, a Crystal Reports palette is available. Also, a Crystal Reports toolbar now appears at the top left of the Visual Studio .NET toolbar area.
I will use this report in various ways as I go through each sample in the article. My first sample involves simply displaying this report, unmodified, in a window. This is easy. Just drop a CrystalReportViewer from the Windows Forms palette of the Toolbox onto the designer for the default form in the project, set its name property to cvwMain, its Dock property to Fill, its ReportSource property to my report (using the Browse option), and then run the application. If I designed the report using a database log in with a blank password, the report will display immediately; otherwise, I am required to log in before displaying. I'll show you how to write code shortly that automates this log in, so that already authenticated users do not have to log in a second time just to run reports.