tailieunhanh - Accessing a Database Using Visual Studio .NET
Accessing a Database Using Visual Studio .NET Visual Studio .NET's Server Explorer allows you to use a subset of the features contained | Accessing a Database Using Visual Studio .NET Visual Studio .NET s Server Explorer allows you to use a subset of the features contained in the Databases folder of Enterprise Manager. Specifically Server Explorer allows you to view create and edit databases database diagrams tables views stored procedures and user-defined functions. In this section you ll be introduced to Server Explorer and some of its functionality. As you ll see Server Explorer operates in a similar way to Enterprise Manager which was covered in Chapter 2. Because of the similarity between Server Explorer and Enterprise Manager I ll only briefly cover Server Explorer here. You should feel free to experiment with Server Explorer yourself. Your first step is to connect to a database. To do this you select Tools Connect To Database. This displays the Data Link Properties dialog box. Figure shows this dialog box with appropriate entries to connect to the Northwind database running on the computer JMPRICE-LAP. Figure Entering database details using the Data Link Properties dialog box Once you ve entered your database details your second step is to click the Test Connection button to verify the database connection details. Click the OK button once your test succeeds. Once you ve connected to the database you can view things such as the tables. You can also retrieve and modify rows in the tables. You can drill down to the tables in the database by clicking the Add icon in the tree in Server Explorer and you can retrieve the rows from a table by clicking the right mouse button on the table in the tree and selecting Retrieve Data From Table in the pop-up window. Figure shows the rows from the Customers table. Figure Viewing the rows in the Customers table using the Server Explorer You can enter SQL statements by clicking the Show SQL Pane button in the toolbar as shown in Figure . Figure Entering a SQL statement You can build SQL statements visually by clicking the Show .
đang nạp các trang xem trước