The Sample Application > Implement the Server Side > Add the Database Access Infrastructure |
Before implementing the Web services, add the database itself to the project. This step is optional. We use a connection string to specify where the database is located, so we could use any existing copy of the MDB file already in the system. We will create a local copy here to facilitate deployment and to avoid making changes to the original database.
To add the database to the project, complete the following steps:
The image below shows the Solution Explorer window after this step is completed:
In addition to the database file, we need a mechanism to transfer data from and to the database. In this sample, we accomplish this using a utility class called SmartDataSet. SmartDataSet extends the regular ADO.NET DataSet class and adds the following:
The SmartDataSet is convenient but not necessary. It knows how to create and configure DataAdapter objects used to load and save data, but you could also write standard ADO.NET code to accomplish the same thing. Because it only uses standard ADO.NET techniques, we do not list it here.
To add the SmartDataSet.cs file to the project, complete the following: