TAILIEUCHUNG - Using a SqlConnection Object to Connect to a SQL Server Database phần 2

The output from this program is as follows: count = 1 Milliseconds = 101 = Open count = 2 Milliseconds = 0 = Open count = 3 Milliseconds = 0 = Open count = 4 Milliseconds | The output from this program is as follows count 1 Milliseconds 101 Open count 2 Milliseconds 0 Open count 3 Milliseconds 0 Open count 4 Milliseconds 0 Open count 5 Milliseconds 0 Open count 6 Milliseconds 0 Open count 7 Milliseconds 0 Open count 8 Milliseconds 0 Open count 9 Milliseconds 0 Open count 10 Milliseconds 0 Open Note Your results might differ from those here. As you can see the time to open the first connection is relatively long compared with the subsequent ones. This is because the first connection makes the actual connection to the database. When it is closed it s stored in the connection pool. When the connection is then opened again it s retrieved from the pool and this retrieval is very fast. Getting the State of a Connection Object The state of a connection enables you to know the progress of your connection request to the database two examples of states are open and closed. You use the Connection object s State property to get the current state of the connection to the database. The State property returns a constant from the ConnectionState enumeration. Note An enumeration is a list of numeric constants each of which has a name. Table lists the constants defined in the ConnectionState enumeration. Table ConnectionState CONSTANTS CONSTANT NAME DESCRIPTION Broken The Connection is broken. This can happen after you ve opened the Connection object. You can close the Connection and reopen it. Closed The Connection is closed. Connecting The Connection is establishing access to the database. Executing The Connection is running a command. Fetching The Connection is retrieving information from the database. Open The Connection is open. Note In version 1 of only the Open and Closed states are used. The other states will be

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.