In ADO.NET dataset browse multiple related tables (2) Author: Microsoft www.ASPCool.com Time: 2003-1-23 13:51:08 Views: 9053
Creating an application This section will establish the starting point of this drill. The subsequent steps will create a data connection, data adapter, and a data set containing the related tables, and a selection and control of the data. Create a new Windows application From the File menu, point to New, and select Project. The New Project dialog will be displayed. In the Project Types pane, select Visual Basic Projects (Visual Basic Project) or Visual C # Projects, depending on the programming language you need. In the Templates pane, select Windows Application (Windows Application) and name it DataRelelationExample, and then click OK. DataReletionExample project will be added to the Solution Explorer. Connecting to the database This connection allows you to communicate with the data source in the Visual Studio integration development environment (IDE). The Ross document Database Connected to the Server Explorer (Server Explorer) is located in Server Explorer (Server Explorer), establishes a data connection to the Ross document Database. Open the Ross text connection in Server Explorer, until all tables can be seen. Creating a data adapter and connection This step Create a connection and data adapter for connecting and exchange data between an application and a data source. Creating a data adapter and connection To drag the Customer table from Server Explorer to the form. Connections and data adapters will be displayed in the component column. Select Connection and set the NAME property to DcNorthWind. Select the data adapter and set the NAME property to Dacustomers. Drag the "Order" table from the Server Explorer (Server Explorer) to the form. The second data adapter will appear in the component column. Select a new data adapter and set the Name property to Daorders. Generating a data set uses a data adapter just added to the form to generate a dataset containing a client table and an order table. Generates a dataset containing the relevant data table from the Data menu, selects the generate dataset (generated data set). The Generate Dataset dialog will be displayed. Tip: Move the cursor to the form to use the DATA menu. Click New and name the dataset DSNorthWind. Select a client table and an order table. Select Add this DataSet to The Designer check box, then click OK.