Building Reports using ASP.NET and Crystal Reports - Part 7 Using Subreports to Create Advanced Reports
page 3 of 7
by Vince Varallo
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 34334/ 70

Step 2: Connect to the AdventureWorksLT database

The next step in designing this report is to connect to the AdventureWorksLT database.  These steps assume you have already downloaded and run the install for the AdventureWorks database.

1.    Right click on the Database Fields node in the Field Explorer.  If you do not see the Field Explorer window select Crystal Reports -> Field Explorer from the menu.  Select Database Expert… from the pop-up menu.

2.    This report is going to connect directly to the database using OLE DB.  To connect to the database click the plus sign next to the Create New Connection node.

3.    Click the plus sign next to OLE DB (ADO).  This will display the OLE DB dialog which allows you to select your AdventureWorksLT database.

4.    Select SQL Native Client from the list of providers and click Next.

5.    Enter the server name where the SQL Server database is installed.

6.    You can either use integrated security or a SQL Login and password to connect to the database.  This depends on how you setup your database when you installed it.  I created a SQL Login called "aspalliance" and gave it a password of "aspalliance" and added the Login to the db_owner role in the AdventureWorksLT database.  Enter the User Id and Password.

7.    Now click on the Database drop down list.  You should see AdventureWorksLT as one of the options.  If you do not then the SQL Login does not have access to the database.  You'll have to use SQL Server Management Studio to add the aspalliance Login and add them to the db_owner role for the AdventureWorksLT database.

8.    Once you have selected AdventureWorksLT for the database click Next and then click Finish.

Your SQL Server should appear under the OLE DB (ADO) node and the AdventureWorksLT database should be listed under the server name.

9.    Click the plus sign next to AdventureWorksLT and you'll see the list of schemas defined in the database.  If you click the plus sign next to a schema name you'll see two nodes, one for Tables and one for Views.  Clicking the plus sign next to either will display the list of tables or views in that schema.

10. The next step is to select the appropriate tables and views for the report and move them to the Selected Tables list in the dialog box. Expand the SalesLT schema and expand the Tables.  Click on the SalesOrderHeader table and then click the > button to move this table to the Selected Tables list.

11. Click the OK buton.

You should now see the report in Visual Studio 2008.  Click the plus sign next to the Database Fields node in the Field Explorer.  You see the SalesOrderHeader table.  Click the plus sign next to the table and you'll see the fields in that table.  These are now available to be used in the report.

View Entire Article

User Comments

Title: Crystal Report   
Name: B.Shah
Date: 2010-09-21 6:43:53 AM
Nice Article..Thanks
Title: Donor Database Administrator   
Name: Abdillahi Jibril
Date: 2010-01-27 11:00:37 AM
I have medium to advanced level experience in Crystal Report, and your article helps me improve my skills to be better Crystal Report Developer.
Title: crystal reports   
Name: joohitha
Date: 2010-01-05 11:47:19 PM
nice article

Tks vincey
Title: crystal reports tutor   
Name: lokesh
Date: 2009-12-28 5:02:03 AM
Thanks vincey
very nice and very help full for crystal report beginners.
i will be at

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-25 10:57:39 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search