异步执行的问题(关于MultipleActiveResultSets的错误)
程序文件 ************************************************
<%@ Page Language= "VB "%>
<%@ Import Namespace= "system.data " %>
<%@ Import Namespace= "system.data.sqlclient " %>
<%@ Import Namespace= "system.configuration " %>
<script runat= "server ">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim conn As SqlConnection
Dim OCmd As SqlCommand = New SqlCommand()
Dim CCmd As SqlCommand = New SqlCommand()
Dim OrdersReader As SqlDataReader
Dim CustReader As SqlDataReader
Dim OASyncResult As IAsyncResult
Dim CASyncResult As IAsyncResult
Dim WHandles(1) As System.Threading.WaitHandle
Dim OrdersWHandle As System.Threading.WaitHandle
Dim CustWHandle As System.Threading.WaitHandle
conn = New SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings( "DSN_NorthWind ").ConnectionString
CCmd.CommandText = "select * from Customers where CompanyName= 'Alfreds Futterkiste ' "
CCmd.CommandType = CommandType.Text
CCmd.Connection = conn
' Selecting all orders for a specific customer
OCmd.CommandText = "select Customers.companyName, Customers.contactName, Orders.OrderID, " & _
"Orders.OrderDate, Orders.requiredDate, Orders.shippedDate from orders, customers where " & _
" orders.CustomerID = customers.customerID and customers.companyName = 'Alfreds FutterKiste ' " & _
" order by Customers.CompanyName, Customers.ContactName "
OCmd.CommandType = CommandType.Text
OCmd.Connection = conn
conn.Open()
' Retrieving customer information