TAILIEUCHUNG - Using the Connection Object

Sử dụng đối tượng Connection Như với , bạn sẽ được sử dụng đối tượng Connection để thiết lập một kết nối cơ sở dữ liệu của bạn lựa chọn. Khi bạn bắt đầu nhìn vào các ví dụ khác nhau, hãy xem biểu mẫu chính sẽ được sử dụng để khởi động mỗi người trong số họ | Using the Connection Object As with you will be using the Connection object to set up a connection to the database of your choice. As you get started looking at the different examples take a look at the main form that will be used to launch each of them shown in Figure . Figure . This form called frmMain is the Main form that is used for the examples in this Appendix. The button that is used for this example is called btnOpenConn and the following is the code used for the Click event shown here in Listing . Listing Code for Calling the Routine to Open and Display the ADO Connection Private Sub btnOpenConn_Click ByVal sender As _ ByVal e As Handles OpenAndDisplayADOConnection End Sub Each of the buttons calls examples passing the text box called txtCurrentResults. This text box is located at the bottom of the form. For clarity the examples have been grouped in modules by section. In this case the first example routine called OpenAndDisplayADOConnection can be found in . The code for this routine is shown in Listing . Listing Code for Opening and Displaying the ADO Connection Sub OpenAndDisplayADOConnection ByVal txtResults As TextBox Dim cnnNet As New Dim strConnect As String _ Provider Integrated Security SSPI Persist Security Info False Initial Catalog Northwind Data Source local strConnect New connection string _ vbCrLf vbCrLf End Sub As you can see from this example using the ADO Connection object is virtually the same as . You can see this example being executed in Figure . Figure . The text displayed here is the connection string that was set. Listing provides two other examples of using the connection object also found in . The first is code to open a connection to a Jet .

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.