In this article, we describe building Windows applications and Web sites for DB2 with IBM tooling for Visual Studio 2005. This article describes how to build such applications and Web sites in accordance with the latest simple paradigm introduced in Visual Studio 2005.
Prerequisite conditions
Before you start building your applications and Web sites, make sure that you have performed the following steps:
Download and install IBM Database add-ins for Visual Studio 2005. For download and installation instructions, please visit the DeveloperWorks information Management Visual Studio. NET zone.
Create the DB2 UDB sample database.
Using Visual Studio 2005 can greatly simplify the task of building a Windows application without having to write any code. The functionality of the default generated application depends on the definition of the table being used. You can use the Microsoft Wizard to create a data source or use a drag-and-drop tool to build a Windows application.
Building Windows applications for departmental tables with the Microsoft Wizard
To use the Microsoft Wizard to create a Windows application for a single department table, follow these steps:
Create a new Windows application using the File > New > Project menu. The application is called Departmentapp. In this article, we will create a C # application.
Figure 1. To create a new C # Windows application
Note: You can also create an vb.net application by following the steps in this article.
In Microsoft Server Explorer, add a connection to the DB2 sample database.
Enter the server name, database name ("Sample"), user name, and password.
Select the option "Save my password".
Expand the Specify Filtering Options section, and then specify the filter for Tables as DEP. Note that filters follow similar search patterns and are case-sensitive.
Add this filter to retrieve all tables that start with "DEP." Note that adding this filter is optional for application development, but if you have a large number of tables in your database, it is recommended that you add filters to achieve better design-time performance.
Optionally, click Test Connection. Click OK. A connection to the sample database will be added in Microsoft Server Explorer.
Figure 2. Connection added to the DB2 sample database
Create a data source for the Department table.
Use the top-level menu data > Add New data Source to invoke the wizard.
Figure 3. Add a new Data Source wizard
In the wizard, leave the default selection "Database". Click Next.
From the list of connections, select the sample database connection that you created earlier. Select the option to include sensitive data in the connection string. Click Next.
Figure 4. Select Database