tailieunhanh - Creating a Connection Object Using Visual Studio .NET

Creating a Connection Object Using Visual Studio .NET To create a SqlConnection object using Visual Studio .NET | Creating a Connection Object Using Visual Studio .NET To create a SqlConnection object using Visual Studio .NET you drag a SqlConnection object from the Data tab of the Toolbox to your form. You ll recall that a SqlConnection object allows you to connect to a SQL Server database. You can also drag an OleDbConnection object from the Toolbox to your form to connect to a database that supports OLE DB. Figure shows a form with a SqlConnection object. This object is assigned the default name of sqlConnection1. Figure Creating a SqlConnection object with Visual Studio .NET Once you ve created a SqlConnection object that object appears in the tray below the form. The tray is used to store nonvisual components like SqlConnection objects. Other objects that appear in the tray are SqlCommand objects. These objects are considered nonvisual because you don t see them when you run your form. You can of course still work with them visually when designing your form. To the right of the form you ll notice the Properties window which you use to set the properties for your SqlConnection object. To set the ConnectionString property that specifies the details of the database connection you can either type in the string directly or click the drop-down list and build the ConnectionString visually. To do this you select New Connection from the drop-down list which displays the Data Link Properties dialog box. This dialog box contains four tabs the first of which is the Provider tab which allows you to select the type of provider you want to connect to as shown in Figure . Figure Selecting the provider Click the Next button to continue to the Connection tab you can also click the Connection tab directly where you enter the details for your database connection as shown in Figure . Figure Entering the connection details Warning For security reasons do not enable the Allow Saving Password check box. If you did your password would be stored in the actual code and anyone

TÀI LIỆU LIÊN QUAN
10    127    1
6    150    1
7    127    1
5    125    1
6    127    1
6    115    1
6    122    1
6    174    1
7    122    1
5    97    1
crossorigin="anonymous">
Đã 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.