tailieunhanh - Murach’s ado net _4 database programming with vb 2010 phần 10
. và giúp bạn tránh được những vấn đề mà bạn có thể chạy vào khi bạn xây dựng các trang web phức tạp. Đó là lý do tại sao cuốn sách này cung cấp cho bạn các ứng dụng hoàn chỉnh, bao gồm các hình thức web, mã aspx, và mã VB. Tải về ứng dụng miễn phí từ trang web murach, và thử nghiệm với họ trên của riêng bạn để xem họ có giá trị | Chapter 17 How to use LẲNQ 639 Exercise 17-1 The Vendor Invoices application In this exercise you ll develop the Vendor Invoices application that was presented at the end of this chapter. This will show you how to build a simple application that uses LINQ to SQL to retrieve data. Create the object model for the application 1. Start a new application named Vendorinvoices in your Chapter 17 folder. 2. Start a new object model named Payables as described in figure 17-11. Then use the Server Explorer to create entity classes from the Vendors and Invoices tables in the Payables database. Include just the columns needed by the application which will be the ones shown in figure 17-16. Create and use the object data sources for the application 3. Rebuild the project then use the Data Source Configuration Wizard as shown in figure 17-15 to create object data sources for the Vendor and Invoice entities in the object model you just created. 4. With the form selected in design view select the Vendor object in the Data Sources window. Change the default control setting for the Vendor object to Details and then change the default control for the Name property to a combo box. Next drag the vendor object onto the form and delete the navigation toolbar that s generated. 5. Set the binding properties for the combo box so the value of the Name property is used as the Display Member and the value of the VendorlD property is used as the Value Member. In addition set the DropDownStyle property of the conttol to DropDownList and remove the binding from the Text property of the control. 6. Drag the Invoice object from the Data Sources window to the form to generate a DataGridView control and automatically create the InvoiceBindingSource. 7. Make the necessary adjustments to the form and its controls so the form looks like the one in figure 17-16. Code and test the application If you need help with any of the coding steps that follow please refer to figure 17-17. 8. Create an instance of .
đang nạp các trang xem trước