TAILIEUCHUNG - Microsoft SQL Server 2005 Developer’s Guide- Part 24

Microsoft SQL Server 2005 Developer’s Guide- P24:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 6 Developing Database Applications with 209 The next point to notice is the use of the rdr SqlDataReader s GetSchemaTable method to actually retrieve the metadata for the query. The GetTableSchema method returns a DataTable object which is then bound to the DataGrid named grdResults using the grid s SetDataBinding method. NOTE ------- While this example illustrates retrieving the column metadata information from a single table the DataReader s GetTableSchema method works just as well with the results of multiple tables. Asynchronous Support Asynchronous query support is a feature that was present in ADO but was missing in the earlier releases of . Asynchronous queries provide client applications the ability to submit queries without blocking the user interference. The new ADO. NET asynchronous support provides the ability for server applications to issue multiple database requests on different threads without blocking the threads. With SQL Server 2005 provides asynchronous support for both opening a connection and executing commands. The asynchronous operation is started using the object s BEGINrrv method and is ended using the method. The IAsyncResult object is used to check the completion status of the command. The following code shows an asynchronous query to return all the rows of the table from the AdventureWorks database Private Sub SQLAsync ByVal sServer As String Create the connection object Dim cn As New SqlConnection SERVER sServer _ INTEGRATED SECURITY True DATABASE AdventureWorks _ ASYNC True Dim cmd As New SqlCommand SELECT FROM cn Dim rdr As SqlDataReader Try Open the connection Dim myResult As IAsyncResult Do While True Perform other actions Loop Process the contents of the reader rdr myResult Open the reader 210 Microsoft SQL Server 2005 Developer s Guide

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.