TAILIEUCHUNG - ASP.NET 2.0 Instant Results phần 3

Các lớp học được gọi là AppConfiguration và không cấu hình, ví dụ, để tránh một cuộc xung đột đặt tên với các hệ thống hiện có cấu hình không gian tên. Lớp AppConfiguration lộ một tài sản được chia sẻ duy nhất ConnectionString gọi, | Wrox Chat Server The following is a copy of the entire contents of the GetChatRoomList method summary Retrieves a DataSet of ChatRooms from the database summary Public Shared Function GetChatRoomList As DataSet Dim dsChatRooms As DataSet New DataSet Try Using mConnection As New SqlConnection Dim mCommand As SqlCommand New SqlCommand _ sprocChatRoomSelectList mConnection Dim myDataAdapter As SqlDataAdapter New SqlDataAdapter mCommand dsChatRooms Return dsChatRooms End Using Catch ex As Exception When we call the Throw statement we are raising the error to the file which will use the default error handling page to process display the custom error to the user Throw End Try End Function The preceding logic performs the following steps 1. Creates a new SqlCommand object passing in the stored procedure name and the connection Using mConnection As New SqlConnection 2. Sets the CommandType to be StoredProcedure and provides the name of sprocChatRoomSelectList Dim mCommand As SqlCommand New SqlCommand _ sprocChatRoomSelectList mConnection 3. Creates a new DataAdapter and assigns its SelectCommand property to the mCommand command object reference. The DataAdapter calls the Fill method which assigns the data to the passed-in dsChatRooms DataSet variable Dim myDataAdapter As SqlDataAdapter New SqlDataAdapter mCommand dsChatRooms 4. Closes the connection and returns the DataSet to the calling function Return dsChatRooms Now that you have had a glimpse at how the business and data layers are structured the next section looks at the client layer WebForms and what the real deal is with callbacks in the graphical user interface execution logic. 87 Chapter 3 WebForms WebForms are standard .

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.