tailieunhanh - Mastering Microsoft Visual Basic 2010 phần 9

mà là kỹ thuật ưu tiên cho tăng dân cư ở DataSet. DataAdapter là không có gì nhiều hơn một bộ sưu tập của các đối tượng Command là cần thiết để thực thi các câu lệnh SQL khác nhau đối với cơ sở dữ liệu. Khi bạn nhớ lại từ cuộc thảo luận trước đó của chúng tôi, | 808 chapter 18 building DATA-BOUND applications For a truly disconnected application you should give users a chance to store the data locally at the client. The LinkedDataTables application s main form contains two more buttons the Save Data Locally and Load Local Data buttons. The first one saves the DataSet to a local file via the WriteXml method of the DataSet and the second button loads the DataSet via the ReadXml method. The application uses the tmpData. @ filename in the application s folder to store the data. It also uses an overloaded form of the two methods to accept an additional argument that stores not only the data but the changes as well. Here s the code behind the two buttons Private Sub Button1_Click . Handles tmpData. @ End Sub Private Sub Button2_Click . Handles tmpData. @ End Sub Let s explore now how data binding can be used in combination with Language Integrated Query LINQ query syntax. Data Binding with LINQ You are surely convinced by now that LINQ is a fundamental part of .NET query infrastructure. You have explored LINQ in detail in Chapter 14 An Introduction to LINQ where I also mentioned the LINQ to DataSet technology. The great thing about LINQ is that once you learn how to write queries you can apply the same syntax to any data source that supports LINQ. DataSets and typed DataSets also support LINQ and you can apply the same syntax you saw used to query objects in LINQ to Objects and in LINQ to SQL to typed DataSets. So far in this chapter you saw how data binding can make life a lot easier for a programmer developing data-centric applications. And you have already witnessed the power of LINQ. The two can be used in combination as a powerful tool for data manipulation. Enabling the Binding with the DataView Class The central class for binding support is the DataView .

TỪ KHÓA LIÊN QUAN