TAILIEUCHUNG - Retrieve XML from SQL Server 2000

Lấy XML từ SQL Server 2000 Đôi khi tôi phải kéo dữ liệu từ cơ sở dữ liệu SQL Server của tôi vào một định dạng văn bản XML. Làm thế nào để làm điều đó với SQL Server 2000? Kỹ thuật Để thực hiện nhiệm vụ này | Retrieve XML from SQL Server 2000 Sometimes I have to pull data from my SQL Server database into an XML document format. How do I do that with SQL Server 2000 Technique To accomplish this task you will create a Command object with the Transact-SQL SELECT statement that you want to execute. However at the end of your SQL statement you will add the clause FOR XML mode. The mode can be any of these that are listed RAW. With this mode each of the rows that is returned in the query result is made into a generic XML element with row as the identifier tag. AUTO. Each of the rows and the columns are identified with tags for each of the elements and attributes using the column names as identifier tags. EXPLICIT. Here you have to nest and create your query in a particular way. For more information on this mode check out the SQL Server Books Online. For this example the code will use the RAW mode and look like this SELECT FROM Customers FOR XML RAW To execute the SQL statement in this case you use the method ExecuteXMLReader. When you use this method an XMLReader is returned. You should then iterate through the elements as seen in How-To . Steps Open and run the Visual Basic .NET-Chapter 12 solution. From the main Web page click on the hyperlink with the caption How-To Retrieving XML from SQL Server 2000. When the page loads you will see an example of a T-SQL statement that retrieves data from SQL Server 2000 in an XML format. Click on the button labeled Retrieve XML and the data will be listed in the TextArea at the bottom of the form see Figure . 1. Create a Web Form. Then place the Label TextBox and Button objects as seen in Figure on the form with the properties in Table set. Table . Label TextBox and Button Control Property Settings Object Property Setting Label Text SQL To Execute TextBox ID txtSQLToExecute Text SELECT FROM Customers FOR XML AUTO ELEMENTS Button ID btnRetrieveXML Text Retrieve XML TextArea ID taOutput HyperLink ID .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.