tailieunhanh - Wrox Professional Crystal Reports for Visual Studio NET Second Edition phần 6

*Ta nhấp nút New Project để hiển thị bảng liệt kê các khuôn mẫu cho ứng dụng (application). *Chọn Visual Basic Project trong window Project Types *Chọn Windows Application trong bảng Template *Đặt tên dự án là Welcome. Lưu ý ở đây, tên của dự án cũng là tên ngăn chứa (folder) chứa phụ dự trữ dự án. | Chapter 5 This report has been written from a single table Customer for which we are setting the Connectioninfo. The name of our server is localhost off of the Northwind database with sa as the user ID and no password. Add this code to the Form1_Load method Private Sub Form1_Load ByVal sender As ByVal e As Handles Dim myReport New ch5_worldsales_northwind Dim myTableLogoninfos New Dim myTableLogoninfo New Dim myConnectioninfo New With myConnectioninfo .ServerName localhost .DatabaseName Northwind .UseriD sa .Password End With myConnectioninfo customers myTableLogoninfo myTableLogoninfos myReport End Sub Make sure that when you are finished setting the Connectioninfo for the table you specify the table name you are working with prior to using the Add method otherwise you will receive an error message. Compile and run the example. The report should appear looking identical to the previous examples. This is a very simple example as our report has only one table to worry about. If you have a report that features multiple tables or if you don t know the names of the tables you could also set up a loop to go through each in and set the Connectioninfo properties for each. In order to get all of the tables in your report and loop through them you will need to use the Report Engine which is covered in Chapter 9 Working with the Crystal Reports Engine. Setting Report Record Selection Just like the functionality found in the Crystal Viewer for Windows applications we can also set the record selection formula that is used to filter our report records when viewing a report through the Web Viewer. Just like the Windows Viewer the .