The detailsview detailsview1 fired event itemupdating
Add another class, Photo Helper, that does the job of executing database queries.The Photo Helper class consists of five methods, as shown in Table 3: Table 3: Methods of the Photo Helper class The static constructor simply reads the database connection string from the web.config using Configuration Manager class.You also saw how to use the API to programmatically create contact persons and their contact data and save those in a database.However, writing explicit code to work with your business objects isn't always fun, and can be a cumbersome task.The retrieved connection string is stored in a static variable for later use. It is shown in Listing 3: Listing 3: Insert() method of Photo Helper class The Insert() method uses Sql Command object's Execute Non Query() method to add a new photo record into the Photos table. The photo parameter that represents binary data is constructed with the Var Binary data type.The Value property of the photo parameter holds a byte array containing the photo data.Each of the other three components of the application has a reference to the objects in the Business Objects layer.This means that the web site can consume objects like that are returned from the business layer that in turn got them from the data access layer.
You saw how to implement the data access methods and database code and how the various classes were able to work together.In the middle of the diagram, you see the Business Logic Layer; the bridge between the web site and the data access layer.The Bll gets instructions from the presentation layer (the web site in this example), to carry out tasks, like retrieving items from the data layer, or sending changed objects back into this layer.Besides the forementioned SQL scripts and database, the download also contains the full source for the demo application in C#.Before we dig into the code for the web site, let's briefly recap the application's design I showed you in the two previous articles.