TAILIEUCHUNG - Wrox’s Visual Basic 2005 Express Edition Starter Kit phần 8

Trong ví dụ thể hiện trong hình 10-7 lĩnh vực SubscriptionId có một giá trị SubscriptionIDHere, mà sẽ gây ra các phương thức dịch vụ web gọi là thất bại. Bạn có thể đặt một breakpoint trực tiếp trước khi được gọi là các dịch vụ web nó sẽ sử dụng giá trị mới thay cũ, | Using XML 2. Open the module and create a new function called ExportPOData that returns a Boolean to indicate success or failure. Give it parameters of a UserID Integer and ExportDataLocation as a String. Add a statement to return True at the end of the function Public Function ExportPOData ByVal UserID As Integer _ ByVal ExportDataLocation As String As Boolean Return True End Function 3. The function accepts only one filename the location for storing the Person data but you want to store the POUser table as well. Therefore create an additional filename from the parameter by changing the file extension Public Function ExportPOData ByVal UserID As Integer _ ByVal ExportDataLocation As String As Boolean Dim POUserLocation As String POUserLocation - 3 3 pou Return True End Function 4. Before you can do the export you should determine whether the files exist already and if so delete them. The object works well here With If .FileExists ExportDataLocation Then .DeleteFile ExportDataLocation If .FileExists POUserLocation Then .DeleteFile POUserLocation End With 5. Now you re ready for the export functionality. To get the data ready you need to create a DataAdapter and a DataTable and then use the Fill method to populate the DataTable. You learned how to do this in Chapter 7. Once the table contains data the only additional command required is the WriteXml method on the DataTable object. Therefore to export the contents of the Person table you could write the following code Dim GetPersonAdapter As New Dim GetPersonTable As New GetPersonTable ExportDataLocation This version of the WriteXml method has a flaw however. Because it doesn t include any definition information about the data stored in the XML file any fields in the table that

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.